Re: correct example of a functional index usage?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dennis Gearon <gearond(at)fireserve(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: correct example of a functional index usage?
Date: 2004-10-22 14:59:57
Message-ID: 7057.1098457197@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dennis Gearon <gearond(at)fireserve(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ed L. 2004-10-22 15:29:00 Re: [Slony1-general] Re: Slony-I 1.0.4 Released
Previous Message Dennis Gearon 2004-10-22 14:25:05 Re: correct example of a functional index usage?