From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ben <midfield@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: encourging bitmap AND
Date: Thu, 23 Dec 2010 15:52:12 -0500
Message-ID: <27812.1293137532@sss.pgh.pa.us> (raw)
In-Reply-To: <5297F6A0-AB39-49F1-80BB-8EE60F3E243E@gmail.com>
References: <5297F6A0-AB39-49F1-80BB-8EE60F3E243E@gmail.com>
Ben <midfield@gmail.com> writes:
> i have a schema similar to the following
> create index foo_s_idx on foo using btree (s);
> create index foo_e_idx on foo using btree (e);
> i want to do queries like
> select * from foo where 150 between s and e;
That index structure is really entirely unsuited to what you want to do,
so it's not surprising that the planner isn't impressed with the idea of
a bitmap AND.
I'd suggest setting up something involving a gist index over an
interval-ish datatype. The PERIOD datatype that Jeff Davis is fooling
with would do what you want --- see
http://pgfoundry.org/projects/temporalhttp://thoughts.j-davis.com/2009/11/08/temporal-keys-part-2/
If you don't want any add-on parts involved, you could fake it by using
a box or possibly lseg.
regards, tom lane
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-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, midfield@gmail.com
Subject: Re: encourging bitmap AND
In-Reply-To: <27812.1293137532@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