pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Database size in Postgresql
3+ messages / 3 participants
[nested] [flat]

* Database size in Postgresql
@ 2008-06-19 19:55  Kunal Gupta <kunalgupta@live.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Kunal Gupta @ 2008-06-19 19:55 UTC (permalink / raw)
  To: pgsql-admin


Hi ,

I have a question, I am suppose to create database with limited size. Is there any way I can set limit to my database created in postgresql.

As per my surfing through various blogs, I found, its not possible directly.This is my approach please let me know if I am going right:

- Since in postgresql (or may be other also), when a database is created, a path to a directory is given in which all data is stored.
- If I restrict the size of this directory then by database size will be automatically controlled.

please let me know if this is right and is there any more simpler way to reach this approach?

Thanks,
Kunal

_________________________________________________________________
The i’m Talkathon starts 6/24/08.  For now, give amongst yourselves.
http://www.imtalkathon.com?source=TXT_EML_WLH_LearnMore_GiveAmongst=

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Database size in Postgresql
@ 2008-06-20 00:18  Joshua D. Drake <jd@commandprompt.com>
  parent: Kunal Gupta <kunalgupta@live.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Joshua D. Drake @ 2008-06-20 00:18 UTC (permalink / raw)
  To: Kunal Gupta <kunalgupta@live.com>; +Cc: pgsql-admin

Kunal Gupta wrote:
> Hi ,
> 
> I have a question, I am suppose to create database with limited size. Is 
> there any way I can set limit to my database created in postgresql.

Not reasonably no.

> - Since in postgresql (or may be other also), when a database is 
> created, a path to a directory is given in which all data is stored.
> - If I restrict the size of this directory then by database size will be 
> automatically controlled.

And you might possibly corrupt data when you hit the barrier.

Joshua D. Drake



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Database size in Postgresql
@ 2008-06-24 19:24  Peter Koczan <pjkoczan@gmail.com>
  parent: Joshua D. Drake <jd@commandprompt.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Peter Koczan @ 2008-06-24 19:24 UTC (permalink / raw)
  To: Joshua D. Drake <jd@commandprompt.com>; +Cc: Kunal Gupta <kunalgupta@live.com>; pgsql-admin

On Thu, Jun 19, 2008 at 7:18 PM, Joshua D. Drake <jd@commandprompt.com> wrote:
> Kunal Gupta wrote:
>>
>> Hi ,
>>
>> I have a question, I am suppose to create database with limited size. Is
>> there any way I can set limit to my database created in postgresql.
>
> Not reasonably no.
>
>> - Since in postgresql (or may be other also), when a database is created,
>> a path to a directory is given in which all data is stored.
>> - If I restrict the size of this directory then by database size will be
>> automatically controlled.
>
> And you might possibly corrupt data when you hit the barrier.

You could always regularly poll the database for the size and generate
a notice or email for you to deal with if it's above a certain
threshold.

postgres=> select pg_database_size('test') as dbsize;
  dbsize
-----------
 609975524

Or, if you need to do do this in bulk,

postgres=> select datname as database, pg_database_size(datname) as
size from pg_database order by database;

I'm not sure how quickly the size statistics get updated, maybe only
after a VACUUM, but this will work as a reactive policy. There's not a
whole lot you can do to enforce proactive quotas in postgres, and as
Joshua mentioned, you might run into bad things.

Peter



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2008-06-24 19:24 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-06-19 19:55 Database size in Postgresql Kunal Gupta <kunalgupta@live.com>
2008-06-20 00:18 ` Joshua D. Drake <jd@commandprompt.com>
2008-06-24 19:24   ` Peter Koczan <pjkoczan@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox