Skip site navigation (1) Skip section navigation (2)

Number of tuples in pg_class - bug or misunderstanding?

From: Martin Neumann <mne(at)mne(dot)de>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Number of tuples in pg_class - bug or misunderstanding?
Date: 2000-05-11 08:04:07
Message-ID: 87wvl1zf60.fsf@darwin.mne.de (view raw or flat)
Thread:
Lists: pgsql-bugs
I'm just digging a little bit in PostgreSQL internals and I found the
following thing. Shouldn't the reltuples field in pg_class contain the
real number of tuples? It is always a little bit to low ...

irc=# SELECT reltuples FROM pg_class WHERE relname = 'events';
 reltuples 
-----------
       188
(1 row)

irc=# SELECT COUNT(*) FROM events;
 count 
-------
   195
(1 row)


This annoys me a little bit as I can do
  SELECT reltuples FROM pg_class WHERE relname = $1;
from plpgsql, but not
  SELECT COUNT(*) FROM $1;
-- 
Martin Neumann
Appartement 201, Emil-Figge-Str. 9, 44227 Dortmund, Germany
mne(at)mne(dot)de - http://www.mne.de/ - PGP key @ http://www.mne.de/mne/pgp.txt


Responses

pgsql-bugs by date

Next:From: Denis SbragionDate: 2000-05-11 10:24:27
Subject: Small bug with numeric in 7.0 (also in 6.5.3)
Previous:From: Vashenko MaximDate: 2000-05-11 07:54:34
Subject: index problem ? (core dumped)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group