Slow counting on v9.3 - Mailing list pgsql-performance

From Kai Sellgren
Subject Slow counting on v9.3
Date
Msg-id CANyR-3ecSwJN9eOLtOLictrnAp0JomF+ZKO-xBVQRtFhzn5gWw@mail.gmail.com
Whole thread Raw
Responses Re: Slow counting on v9.3
Re: Slow counting on v9.3
List pgsql-performance
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 counts without filters.

This performs quickly:

SELECT reltuples AS count
FROM pg_class
WHERE relname = 'NewsArticle';

But I'd like to add conditions so I don't like the last method.


--
Yours sincerely,
Kai Sellgren

pgsql-performance by date:

Previous
From: ambilalmca
Date:
Subject: PostgreSQL query for cache performance counters?
Next
From: Mehmet Çakoğlu
Date:
Subject: Re: Slow counting on v9.3