Skip site navigation (1) Skip section navigation (2)

Index-only quals

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Index-only quals
Date: 2009-08-21 11:43:45
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Here is an updated version of my patch to return data from b-tree
indexes, and use it to satisfy quals.

I added a new column 'amregurgitate' to pg_am, to mark which indexams
can return index tuples. Also, the data type of the index column in
pg_attribute must match the type of the heap column - this catches the
hack that 'name' is stored as cstring, that I had hardcoded before.

As discussed, GiST/GIN would need more infrastructure to mark which
opclasses can return tuples, but as long as GiST/GIN doesn't support
regurgitation at all, I'm not going to complicate the catalogs with that.

There's also some planner fixes - indexes that are only useful because
of index-only quals are not considered for bitmap scans, and volatile
expressions mustn't be used as index-only quals.

This patch comes in two parts. Indexam API changes, which just splits
the indexam_getnext function into two without providing any new
functionality, and the main patch that applies on top of the indexam API
changes. The patches are also available at
git://, branches
'indexam-api-changes and 'indexfilter'.

Barring objections, I'm going to apply the indexam API changes part,
since that simplifies the code in question regardless of the rest of the
work. I'm pretty happy now with the indexfilter patch as well, but want
to do some more testing on that before committing. Some more eyeballs
would be appreciated as well.

  Heikki Linnakangas

Attachment: split-index_gettuple-2.patch
Description: text/x-diff (27.0 KB)
Attachment: indexfilter-2.patch
Description: text/x-diff (51.7 KB)


pgsql-hackers by date

Next:From: Greg StarkDate: 2009-08-21 11:57:05
Subject: Re: Index-only quals
Previous:From: Paul MatthewsDate: 2009-08-21 11:42:57
Subject: Re: Geometric Elimination

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group