Re: fast count(*) through statistics collector

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: Artem Yazkov <markkrass(at)kemcity(dot)ru>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: fast count(*) through statistics collector
Date: 2008-03-19 10:22:11
Message-ID: 1205922132.4285.369.camel@ebony.site
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 2008-03-18 at 21:26 +0700, Artem Yazkov wrote:

> Restrictions:
> 1. Uninterrupted supply of statistics collector necessary for
> efficient use of this algorithm.

In my understanding, we do not guarantee this. That leaves the rest of
your ideas drifting, I'm sorry to say. Your ideas and analysis did seem
good though, so please don't be put off.

> 2. Works only for simplest queries like:
> select count (*) from regular_table

Personally, I don't see the need to make just that single statement go
faster. It only runs slowly on large tables and they seldom need exactly
accurate counts frequently enough for us to care. Or put it another way,
I never saw a real application where this was a significant performance
issue, on any RDBMS.

I believe this is a marketing issue for us, only. Other RDBMS supporters
know count(*) runs slower on PostgreSQL and use that as evidence of poor
performance.

We do need a general solution to improving the performance of
aggregates, though that is already roughly on the TODO in the shape of
materialized view support.

--
Simon Riggs
2ndQuadrant http://www.2ndQuadrant.com

PostgreSQL UK 2008 Conference: http://www.postgresql.org.uk

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikolay Samokhvalov 2008-03-19 12:03:48 Multiple SRF right after SELECT
Previous Message Martijn van Oosterhout 2008-03-19 09:51:12 Re: [PATCHES] Fix for large file support (nonsegment mode support)