Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 31030650EE5 for ; Tue, 24 Jun 2008 16:24:21 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 37738-02 for ; Tue, 24 Jun 2008 16:24:13 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.174]) by postgresql.org (Postfix) with ESMTP id 48875650ED8 for ; Tue, 24 Jun 2008 16:24:14 -0300 (ADT) Received: by wf-out-1314.google.com with SMTP id 25so2740501wfc.28 for ; Tue, 24 Jun 2008 12:24:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=QI3uSc/mdGLRni9eSI89Oj8y6P+Cjp7sUhndkgFBhMg=; b=lTIc7HEsOn2UAq4SUhdlgEz2xJtSZEvvQEedxBRVB8WFRv51Uz5aJhVmijbhQsf5S5 gjgOHVTg4TjaD6k2QTgl2BEV4RG4QYrwft1UZcT/8TBtd4Ko7zq1T7NkiyYXhN9XPRmG XCBaMKFs+tV8zeuALQScyw3EmXiu84M4B1Nns= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=gaZwyBI0oTYr27ncJeEDwGRdstk+QvWOCPeEJqcC9cmN7nvbRglsbwISZ7MX3tJ5rb WdUwkt637x7LBv2Tr+bkPO2HOuJaSDtA+U3YscWIy6zFoJfzHhGHDVY+bmjPzSMQFrVN e11ADmzNz6ppshJy8yBw5kEWlw4sfuz3rzGhU= Received: by 10.142.211.1 with SMTP id j1mr6146538wfg.231.1214335453488; Tue, 24 Jun 2008 12:24:13 -0700 (PDT) Received: by 10.150.53.20 with HTTP; Tue, 24 Jun 2008 12:24:13 -0700 (PDT) Message-ID: <4544e0330806241224n492e1bfarcc96babcd2768969@mail.gmail.com> Date: Tue, 24 Jun 2008 14:24:13 -0500 From: "Peter Koczan" To: "Joshua D. Drake" Subject: Re: Database size in Postgresql Cc: "Kunal Gupta" , pgsql-admin@postgresql.org In-Reply-To: <485AF746.4020100@commandprompt.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <485AF746.4020100@commandprompt.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200806/210 X-Sequence-Number: 29548 On Thu, Jun 19, 2008 at 7:18 PM, Joshua D. Drake 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