pg_class table problem

Started by Shilong Stanley Yaoabout 22 years ago3 messagesgeneral
Jump to latest

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

#2Martijn van Oosterhout
kleptog@svana.org
In reply to: Shilong Stanley Yao (#1)
Re: pg_class table problem

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/

Show quoted text

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

In reply to: Shilong Stanley Yao (#1)
Re: pg_class table problem

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