Home > Archive > PostgreSQL Administration > November 2006 > Database size









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Database size
Nikola Radakovic

2006-11-07, 7:18 pm

Dear community,

I would be very grateful if someone could answer me,
where to find instructions how to set the size ( in megabytes ) for
particular database.


best regards,
N.Radakovic


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql
.org so that your
message can get through to the mailing list cleanly

Chris Hoover

2006-11-07, 7:18 pm

select pg_database_size('<dbname>')/1024/1024;

http://www.postgresql.org/docs/8.1/...ions-admin.html

On 11/6/06, Nikola Radakovic <achillea@hi.t-com.hr> wrote:
>
> Dear community,
>
> I would be very grateful if someone could answer me,
> where to find instructions how to set the size ( in megabytes ) for
> particular database.
>
>
> best regards,
> N.Radakovic
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql
.org so that your
> message can get through to the mailing list cleanly
>


Richard Broersma Jr

2006-11-07, 7:18 pm

> I would be very grateful if someone could answer me,
> where to find instructions how to set the size ( in megabytes ) for
> particular database.


I don't understand the question, are you looking to limit the size of your database?

Regards,

Richard Broersma Jr.


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Mike Goldner

2006-11-07, 7:18 pm

Nikola,

I'm not exactly sure what you are asking.

The size of the database is usually determined by the amount of data
stored and not determined beforehand.

Are you refering of "tablespaces", as other DBMSs use them? If so,
Postgres has a tablespace command, but it simply points to a filesystem
location. There is no "size" specified.

The size of the database is simply limited by the available filesystem
capacity (I suppose there may be some restrictions at the high-end).

Mike

On Mon, 2006-11-06 at 14:48 -0600, Nikola Radakovic wrote:
> Dear community,
>
> I would be very grateful if someone could answer me,
> where to find instructions how to set the size ( in megabytes ) for
> particular database.
>
>
> best regards,
> N.Radakovic
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql
.org so that your
> message can get through to the mailing list cleanly

--
Mike Goldner
Vice President Networks and Technology
AG Mednet, Inc.
The Pilot House
Lewis Wharf
Boston, MA 02110
617.854.3225 (office)
617.909.3009 (mobile)

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Richard Broersma Jr

2006-11-07, 7:18 pm

> I appreciate your help, You don't understand me because my English is
> awful.
> I would try to paraphrase the sentence-maybe I succeed to correctly
> express myself.I want to limit database space for each database user on
> my system.For example, One user can hold one or more databases, but I
> want to limit him in order that he isn't able to store data which will
> exceed some limit(in megabytes) which I'll set.
> Something like in webhosting, where each user has limited database space
> on usage.


I see what you are trying to achieve. Also, dont forget to reply-all when you reply to email from
the postgresql lists so that everyone on the lists are copied with your emails. This way everyone
on the list can participate in this discussion. This is important since, I can not think of an
answer for your question. :o)

Regards,

Richard Broersma Jr.

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Nikola Radakovic

2006-11-07, 7:18 pm

Setting user's quota on my linux machine wont affect database
quota.It will have impact on users directories.So, it must
be a trick how to set PostgreSQL quota. Or how to link PostgreSQL
database with directories which already have set quotas.




On Mon, 2006-11-06 at 16:52 -0500, Mike Goldner wrote:
> On Mon, 2006-11-06 at 15:41 -0600, Nikola Radakovic wrote:
>
> Nikola,
>
> Setting quotas is operating system-dependent. If you are using linux,
> take a look at http://yolinux.com/TUTORIALS/LinuxTutorialQuotas.html
>



---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Scott Marlowe

2006-11-07, 7:18 pm

On Mon, 2006-11-06 at 16:29, Nikola Radakovic wrote:
> Setting user's quota on my linux machine wont affect database
> quota.It will have impact on users directories.So, it must
> be a trick how to set PostgreSQL quota. Or how to link PostgreSQL
> database with directories which already have set quotas.


PostgreSQL itself has no ability to set quotas.

You can limit the amount of data a particular table space uses, either
by drive size or quota. But for individual users, I don't think there's
a solution.

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Mike Goldner

2006-11-07, 7:18 pm

On Mon, 2006-11-06 at 16:29 -0600, Nikola Radakovic wrote:
> Setting user's quota on my linux machine wont affect database
> quota.It will have impact on users directories.So, it must
> be a trick how to set PostgreSQL quota. Or how to link PostgreSQL
> database with directories which already have set quotas.
>
>
>
>
> On Mon, 2006-11-06 at 16:52 -0500, Mike Goldner wrote:
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org



Assuming that you are running Postgres on a linux system, you could do
the following:

1) Create a partition with quotas enabled (via standard linux OS
procedures). The postgres user is the user for which quotas should be
enforced since postgresql always runs under the postgres uid.

2) Create a postgres tablespace using the newly created partition:

psql> CREATE TABLESPACE dbspace LOCATION '/data/dbs';

3) Create the database on that tablespace:

psql> CREATE DATABASE sales OWNER salesapp TABLESPACE dbspace;

I have not tried this myself.

As a side note, I'd say that limiting the size of a database to an
arbitrary amount is problematic. Should a user actually exhaust the
disk quota, Postgres will be unable to commit the transaction.
Furthermore, it is difficult to recover from such a situation without
major effort.

--
Mike Goldner
Vice President Networks and Technology
AG Mednet, Inc.
The Pilot House
Lewis Wharf
Boston, MA 02110
617.854.3225 (office)
617.909.3009 (mobile)

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Richard Broersma Jr

2006-11-07, 7:18 pm

> Assuming that you are running Postgres on a linux system, you could do
> the following:
>
> 1) Create a partition with quotas enabled (via standard linux OS
> procedures). The postgres user is the user for which quotas should be
> enforced since postgresql always runs under the postgres uid.
>
> 2) Create a postgres tablespace using the newly created partition:
>
> psql> CREATE TABLESPACE dbspace LOCATION '/data/dbs';
>
> 3) Create the database on that tablespace:
>
> psql> CREATE DATABASE sales OWNER salesapp TABLESPACE dbspace;
>
> I have not tried this myself.
>
> As a side note, I'd say that limiting the size of a database to an
> arbitrary amount is problematic. Should a user actually exhaust the
> disk quota, Postgres will be unable to commit the transaction.
> Furthermore, it is difficult to recover from such a situation without
> major effort.


These links supplement the above comments:
http://www.postgresql.org/docs/8.1/.../disk-full.html
http://www.postgresql.org/docs/8.1/...ablespaces.html

Regards,

Richard Broersma Jr.

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com