From: Peter Koczan <pjkoczan@gmail.com>
To: Joshua D. Drake <jd@commandprompt.com>
Cc: Kunal Gupta <kunalgupta@live.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Database size in Postgresql
Date: Tue, 24 Jun 2008 14:24:13 -0500
Message-ID: <4544e0330806241224n492e1bfarcc96babcd2768969@mail.gmail.com> (raw)
In-Reply-To: <485AF746.4020100@commandprompt.com>
References: <BLU126-W48DEEB352F79916DA1E598A9AA0@phx.gbl>
<485AF746.4020100@commandprompt.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: pjkoczan@gmail.com, jd@commandprompt.com, kunalgupta@live.com
Subject: Re: Database size in Postgresql
In-Reply-To: <4544e0330806241224n492e1bfarcc96babcd2768969@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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