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

Re: Connection function

From: Joe Abbate <jma(at)freedomcircle(dot)com>
To: psycopg(at)postgresql(dot)org
Subject: Re: Connection function
Date: 2012-03-26 04:07:44
Message-ID: (view raw, whole thread or download thread mbox)
Lists: psycopg
On 03/25/2012 09:00 PM, Bill House wrote:
> Regarding the statistics, I have since learned that the command:
>     select reltuples from pg_class where relname = 'your_file_name';
> Will give a record count.  I don't know how well it will keep up in a
> dynamic environment but it's a start.

reltuples "is only an estimate used by the planner."  See

So if you want a more or less accurate count of rows at that given point
in time, then you should not depend on it.

As for the optimization of SELECT count(*) which Adrian had mentioned,
it's a 9.2 feature (as a result of index-only scans).  See under Cache Usage.


In response to

psycopg by date

Next:From: Federico Di GregorioDate: 2012-03-26 07:52:02
Subject: Re: Connection function
Previous:From: Adrian KlaverDate: 2012-03-26 01:58:31
Subject: Re: Connection function

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