Re: How do I measure user disk usage on Postgresql table?

From: Richard Huxton <dev(at)archonet(dot)com>
To:
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How do I measure user disk usage on Postgresql table?
Date: 2008-04-18 12:50:38
Message-ID: 4808991E.7060501@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dave wrote:
> Lets say I have a Postgresql table where I store uploaded data for
> all users, identified by user_id column. Is it possible to run a
> query to measure the storage a user is consuming?

Not really. You could get the size of the whole table with
pg_relation_size() and then estimate a user's share by seeing what % of
rows have their user-id.

If it's the sort of thing you'll be checking constantly, then I'd keep a
summary table up-to-date using triggers instead.

Oh - if you're going to be asking questions regularly then you'll
probably get more answers if you have a valid email address.

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-04-18 14:43:59 Re: good experience with performance in 8.2 for multi column indexes
Previous Message Terry Lee Tucker 2008-04-18 12:40:54 Re: How to retore a pg_dumpall dump?