Re: index-only count(*) for indexes supporting bitmap scans

Andrew Gierth <andrew@tao11.riddles.org.uk>

From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Alexander Kuzmenkov <a.kuzmenkov@postgrespro.ru>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2017-04-12T10:38:05Z
Lists: pgsql-hackers
>>>>> "Alexander" == Alexander Kuzmenkov <a.kuzmenkov@postgrespro.ru> writes:

 Alexander> Structurally, the patch consists of two major parts: a
 Alexander> specialized executor node

Why?

It strikes me that the significant fact here is not that we're doing
count(*), but that we don't need any columns from the bitmap heap scan
result.  Rather than creating a whole new node, can't the existing
bitmap heapscan be taught to skip fetching the actual table page in
cases where it's all-visible, not lossy, and no columns are needed?

(this would also have the advantage of getting parallelism for free)

-- 
Andrew (irc:RhodiumToad)


Commits

  1. Allow bitmap scans to operate as index-only scans when possible.