pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
reltuples value less than rows in the table.
2+ messages / 2 participants
[nested] [flat]

* reltuples value less than rows in the table.
@ 2011-08-24 10:04 parul <i.parultyagi@gmail.com>
  2011-08-25 14:43 ` Re: reltuples value less than rows in the table. Kevin Grittner <Kevin.Grittner@wicourts.gov>
  0 siblings, 1 reply; 2+ messages in thread

From: parul @ 2011-08-24 10:04 UTC (permalink / raw)
  To: pgsql-performance

I have a index in a table. The value of the reltuples value in the pg_class
table for this index is less than the number of rows in the table where the
index is present.
For eg. if i have 800 rows in the table , the reltuples in the pg_class for
the index show the value as 769.
What are the scenarios under which this kind of behaviour occurs?
Also iam not able to execute the queries involving the indexed column in the
where clause.
Please suggest the probable cause for this. 
Also if i do a reindex on the table, the reltuple values updates to the
current no. of rows ie. 800.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/reltuples-value-less-than-rows-in-the-table-tp4729917p472991...
Sent from the PostgreSQL - performance mailing list archive at Nabble.com.



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: reltuples value less than rows in the table.
  2011-08-24 10:04 reltuples value less than rows in the table. parul <i.parultyagi@gmail.com>
@ 2011-08-25 14:43 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
  0 siblings, 0 replies; 2+ messages in thread

From: Kevin Grittner @ 2011-08-25 14:43 UTC (permalink / raw)
  To: parul <i.parultyagi@gmail.com>; pgsql-performance

parul <i.parultyagi@gmail.com> wrote:
 
> I have a index in a table. The value of the reltuples value in the
> pg_class table for this index is less than the number of rows in
> the table where the index is present.
> For eg. if i have 800 rows in the table , the reltuples in the
> pg_class for the index show the value as 769.
> What are the scenarios under which this kind of behaviour occurs?
 
The fine manual explains it here:
 
http://www.postgresql.org/docs/9.0/interactive/catalog-pg-class.html
 
To quote:
 
| Number of rows in the table. This is only an estimate used by the
| planner. It is updated by VACUUM, ANALYZE, and a few DDL commands
| such as CREATE INDEX.
 
Other operations which affect the number of rows in the table won't
change this column, so it can be off by a bit until the next
autovacuum or explicit operation which sets a new estimate.
 
> Also iam not able to execute the queries involving the indexed
> column in the where clause.
 
Are you saying that you expect that a plan would have been chosen
which would have used the index, but it is choosing some other plan?
If so, your best bet is to present the actual query.
 
http://wiki.postgresql.org/wiki/SlowQueryQuestions
 
-Kevin



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2011-08-25 14:43 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-08-24 10:04 reltuples value less than rows in the table. parul <i.parultyagi@gmail.com>
2011-08-25 14:43 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox