From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alexander Kuzmenkov <a.kuzmenkov@postgrespro.ru>
Cc: Andrew Gierth <andrew@tao11.riddles.org.uk>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: index-only count(*) for indexes supporting bitmap scans
Date: Wed, 12 Apr 2017 10:24:30 -0400
Message-ID: <31289.1492007070@sss.pgh.pa.us> (raw)
In-Reply-To: <ca192322-29fd-9e60-3766-fe5e69d1f9af@postgrespro.ru>
References: <239a8955-c0fc-f506-026d-c837e86c827b@postgrespro.ru>
<87ziflvryn.fsf@news-spur.riddles.org.uk>
<8437.1491998661@sss.pgh.pa.us>
<ca192322-29fd-9e60-3766-fe5e69d1f9af@postgrespro.ru>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Alexander Kuzmenkov <a.kuzmenkov@postgrespro.ru> writes:
> With planner, the changes are more complex. Two things must be done
> there. First, when the tlist is empty, we must use a different cost
> function for bitmap heap scan, because the heap access pattern is
> different. Second, choose_bitmap_and() must use a different algorithm
> for choosing the right combination of paths. A standard algorithm
> chooses the combination based on cost. For count(*) purposes, the
> decisive factor is that the path has to check all the restrictions, or
> else we'll need heap access to recheck some of them, which defeats the
> purpose of having this optimization. The planner code that builds and
> costs the index path is fairly complex, and integrating this additional
> behavior into it didn't look good to me.
TBH, I'm not sure you need to do any of that work. Have you got evidence
that the planner will fail to choose the right plan regardless? I'm
particularly unconvinced that choose_bitmap_and is a critical problem,
because once you're into having to AND multiple indexes, you're talking
about an expensive query anyhow.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, a.kuzmenkov@postgrespro.ru, andrew@tao11.riddles.org.uk
Subject: Re: index-only count(*) for indexes supporting bitmap scans
In-Reply-To: <31289.1492007070@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox