Slow counting on v9.3

From: Kai Sellgren <kaisellgren(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Slow counting on v9.3
Date: 2014-01-13 21:57:20
Message-ID: CANyR-3ecSwJN9eOLtOLictrnAp0JomF+ZKO-xBVQRtFhzn5gWw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Josh Kupershmidt 2014-01-14 16:51:42 COMMIT stuck for days after bulk delete
Previous Message ambilalmca 2014-01-10 09:46:50 PostgreSQL query for cache performance counters?