Thread: pg_class table problem

pg_class table problem

From
Shilong Stanley Yao
Date:
Hi,
I inserted thousands of records in a table, but when using "select
relname, relpages from pg_class;", the number of pages of the table in
which I am inserting records is always 10, which is the same as an empty
table.  Am I doing anything wrong? Thanks, -Stan

Re: pg_class table problem

From
Martijn van Oosterhout
Date:
On Wed, Mar 17, 2004 at 03:29:33PM -0700, Shilong Stanley Yao wrote:
> Hi,
> I inserted thousands of records in a table, but when using "select
> relname, relpages from pg_class;", the number of pages of the table in
> which I am inserting records is always 10, which is the same as an empty
> table.  Am I doing anything wrong? Thanks, -Stan

These figures are updated by VACUUM and possibly by ANALYZE also.

--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> If the Catholic church can survive the printing press, science fiction
> will certainly weather the advent of bookwarez.
>    http://craphound.com/ebooksneitherenorbooks.txt - Cory Doctorow

Attachment

Re: pg_class table problem

From
Shilong Stanley Yao
Date:

Marc Durham wrote:
> The relpages value is an estimated value I believe.  Try using VACUUM to
> update it:
>     VACUUM mytable;
>     SELECT relname, relpages from pg_class;
>
> -Marc-
Thank you all for your help.  "vacuum" does help!  Now I got the
accurate numbers. -Stan