Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XLtVy-0006Rn-1O for pgsql-admin@arkaria.postgresql.org; Mon, 25 Aug 2014 12:36:50 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XLtVx-0007c0-7n for pgsql-admin@arkaria.postgresql.org; Mon, 25 Aug 2014 12:36:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XLtVv-0007Zy-UK for pgsql-admin@postgresql.org; Mon, 25 Aug 2014 12:36:47 +0000 Received: from brisi.sourcepole.ch ([5.9.57.43]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1XLtVs-0004QO-4P for pgsql-admin@postgresql.org; Mon, 25 Aug 2014 12:36:46 +0000 Received: from 164.8.24.31.ftth.as8758.net ([31.24.8.164] helo=[192.168.178.90]) by vilan-mail with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XLtVq-0003w9-RV; Mon, 25 Aug 2014 14:36:42 +0200 Message-ID: <53FB2DDA.9060303@sourcepole.ch> Date: Mon, 25 Aug 2014 14:36:42 +0200 From: =?UTF-8?B?SG9yc3QgRMO8c3Rlcg==?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: hubert depesz lubaczewski CC: pgsql-admin@postgresql.org Subject: Re: Database User Quota References: <53FB1C28.5080808@sourcepole.ch> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi depesz Thanks a lot for your quick response. I'll have a look on your solution soon. All the best Horst Am 25/08/14 um 13:34 schrieb hubert depesz lubaczewski: > You could add script that would scan databases, and summarize size of > objects per owner role. > > More or less something like: > > for a in $( psql -c "select datname from pg_database where datallowconn" > -qAtX ) > do > psql -d $a -c "select u.usename, pg_table_size(c.oid) from pg_class c > join pg_user u on c.relowner = u.usesysid where c.relkind in ('r', 'i')" > -qAtX -F, > done | \ > awk -F, '{s[$1]+=$2} END{for (i in s) {printf "%-30s : %20d\n", i, > s[i]}}' | \ > sort -nk2 > > And then, run it from cron, add some logic to alert user/admin or simply > block user access. > > depesz > > > > On Mon, Aug 25, 2014 at 1:21 PM, Horst Düster > wrote: > >> > Hi > > I'm looking for a method to set quotas per user in a Postgresql Database > Cluster. After searching around I found the trigger called check_quota. > But this trigger has to be added to every table stored in a database. > What I'm looking for is a cluster wide quotation based on user or role. > > Any help or hint are very appreciated. > > All the best > Horst Düster > > > >> >> >> >> -- >> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) >> To make changes to your subscription: >> http://www.postgresql.org/mailpref/pgsql-admin >> > - -- Dr. Horst Düster Managing Director Sourcepole AG - Linux & Open Source Solutions Weberstrasse 5, 8004 Zürich, Switzerland Tel: +41 (0)44 440 77 11 Direkt: +41 (0)44 515 67 70 horst.duester@sourcepole.ch http://www.sourcepole.ch www.sourcepole.ch/kurse - Das Kursangebot Herbst 2014 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJT+y3aAAoJENxaj+NbOI6S8dAH/iaVfBFqAnTjP3WyF7/8CIXB 0Ju7uTG35tN5hEXTbUJYVO0Ly5dd7nEBDaGSMZkMMHyPGOM92zeKJif9sX/xrPBu 0lNnUjq/crp5pvkh2u2BtvNfHawzbEDapCzoCkI4KlkOoyyYzGUO3rMpWprY/H/j q1ZJrd6saHIrOfRRwuoq8Sg1fUdcCcTpcBBT4s9mkhfRCrUAwPhcv2n6k458kO0z glJiWdMq+KaD6GyZawBxc4XLJJEvn0oiyvhZ7OkroboKPO2bQcwb7538S8Hl/8IP CdDRbAZWdrrXdmmeB5k7Alt+DOtxDNjQdr4+g9NzH1GfF50yWEFagGp8xEsslJQ= =aNNI -----END PGP SIGNATURE----- -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin