On 2010-10-26, John R Pierce <pie...@hogranch.com> wrote:
>
> count(*) has to read the whole table to get the accurate count.   The 
> reason for this is that different clients can see different versions of 
> that table, for instance, if client A is already in a transaction, and 
> client B then does an INSERT, the two clients will see different values 
> for the count.

They may or may not. the default transaction isolation level "read commited"
allows a session to see most changes that were committed externally after the
start of the transaction.

Tlso the index may include deleted rows.
which is another reason count(*) does a table scan.

-- 
ɹǝpun uʍop ɯoɹɟ sƃuıʇǝǝɹ⅁


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to