Search Postgresql Archives

Re: Why Select Count(*) from table - took over 20 minutes?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2010-10-26, John R Pierce <pierce@xxxxxxxxxxxx> 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@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux