From: | Shridhar Daithankar <shridhar_daithankar(at)myrealbox(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Huge Data |
Date: | 2004-01-14 13:50:33 |
Message-ID: | 200401141920.33017.shridhar_daithankar@myrealbox.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wednesday 14 January 2004 18:55, Sezai YILMAZ wrote:
> Shridhar Daithankar wrote:
> >Rather than doing count(*), you should either cache the count in
> > application memory
> >
> > or analyze often and use following.
> >
> >'select reltuples from pg_class where relname = 'foo';
>
> Thank you very much Shridhar. This one is responsive immediately. I
> think I will use this method for gathering row count. But I complain to
> break SQL standards. The code will become unmovable.
Well, you could document it somewhere for your reference. It is not that
hard..:-)
And remember, the value you get is just an estimate. You need to analyze the
table often with respect to it's update/insert/delete activity to keep the
estimate reasonable accurate. Vacuuming would also update the estimate.
Shridhar
From | Date | Subject | |
---|---|---|---|
Next Message | Sander Steffann | 2004-01-14 13:59:33 | Re: 7.4.1 packages for RHEL2.1 |
Previous Message | Nick Barr | 2004-01-14 13:46:16 | Re: Using regular expressions in LIKE |