From: pgsql-performance-ow...@postgresql.org
[mailto:pgsql-performance-ow...@postgresql.org] On Behalf Of Kai Sellgren
Sent: Thursday, January 09, 2014 4:37 PM
To: pgsql-performance@postgresql.org
Subject: [PERFORM] Issue with query scanning through all data even with indexes
Hi,
I have a query
Kai Sellgren writes:
> Hi,
>
> I'm experiecing slow count performance:
>
> SELECT COUNT(*) AS "count"
> FROM "NewsArticle"
>
> Takes 210 ms. I've run analyze and vacuum. I'm on 9.3. Here're the stats
> http:/
> /d.pr/i/6YoB
>
> I don't understand why is it that slow. It returns 1 integer, and co
Hi Kai,
You are right, postgresql Count() function is slow, because; It's
physically count the rows one by one.
Other database systems using indexes for counting, but postgresql walk
through all rows in multiple transactions with different row states for
calculating the real row count. This is ab