Re: [RFC] speed up count(*)

From: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
To: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [RFC] speed up count(*)
Date: 2021-10-20 18:33:15
Message-ID: CAFBsxsEg0qdfx=LKM46=9ntZuYcLnvyOhkKKxq=WXc_Eh8vB3A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Oct 20, 2021 at 2:23 PM Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
wrote:
>
> Couldn't we simply inspect the visibility map, use the index data only
> for fully visible/summarized ranges, and inspect the heap for the
> remaining pages? That'd still be a huge improvement for tables with most
> only a few pages modified recently, which is a pretty common case.
>
> I think the bigger issue is that people rarely do COUNT(*) on the whole
> table. There are usually other conditions and/or GROUP BY, and I'm not
> sure how would that work.

Right. My (possibly hazy) recollection is that people don't have quite as
high an expectation for queries with more complex predicates and/or
grouping. It would be interesting to see what the balance is.

--
John Naylor
EDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Dilger 2021-10-20 18:39:52 Re: Delegating superuser tasks to new security roles (Was: Granting control of SUSET gucs to non-superusers)
Previous Message Jeff Davis 2021-10-20 18:27:11 Re: Delegating superuser tasks to new security roles (Was: Granting control of SUSET gucs to non-superusers)