Re: correct example of a functional index usage? - Mailing list pgsql-general

From Tom Lane
Subject Re: correct example of a functional index usage?
Date
Msg-id 7057.1098457197@sss.pgh.pa.us
Whole thread Raw
In response to Re: correct example of a functional index usage?  (Dennis Gearon <gearond@fireserve.net>)
Responses Re: correct example of a functional index usage?  (Dennis Gearon <gearond@fireserve.net>)
List pgsql-general
Dennis Gearon <gearond@fireserve.net> writes:
> But it is possible to use multiple indexes on dates, and that is why the one at the bottom works, right?

No, it is possible to use multiple conditions that are relevant to a
single index.  A range query like "where x >= lobound and x <= hibound"
works very nicely with a btree index on x.  But "where x >= lobound and
y <= hibound" isn't a range query.

> Would a single index get used for

> SELECT appointment
> FROM the_table
> WHERE 0 <> (date_mask &&  date_range);

I don't see any indexable operator there at all.  You might care to read
http://developer.postgresql.org/docs/postgres/xindex.html
which describes the behaviors Postgres indexes have.

            regards, tom lane

pgsql-general by date:

Previous
From: Jan Wieck
Date:
Subject: Re: Slony-I 1.0.4 Released
Next
From: Eric E
Date:
Subject: PlPERL and shared libraries on Suse