Re: [HACKERS] queries on 2+ indices

From: Marc Tardif <admin(at)wtbwts(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] queries on 2+ indices
Date: 2000-02-18 11:40:40
Message-ID: Pine.BSF.4.10.10002181124360.17592-100000@server.b0x.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I'm not sure I understand what is "qpqual" in your explanation. Once the
first indexscan is performed, is a temporary table created (in-file or
in-memory) containing the relevant tuples? If not, how can the remaining
part of the WHERE clause be evaluated against the previously selected
tuples during the first indexscan? Or, is the remaining part of the WHERE
clause re-evaluated again and again for each of the found tuples in the
first indexscan?

On Fri, 18 Feb 2000, Tom Lane wrote:

> Marc Tardif <admin(at)wtbwts(dot)com> writes:
>
> > For example, assuming the following:
> >
> > create table t1 ( f1 int, f2 int);
> > create index t1_f1 on t1 (f1);
> > create index t1_f2 on t1 (f2);
> > select * from t1 where f1=123 and f2=456;
>
> The optimizer will attempt to guess which index is more selective
> (will return fewer tuples for its part of the WHERE clause). That
> index would be used for the indexscan, and the rest of the WHERE
> clause would be applied as a "qpqual", ie actually evaluated as
> an expression against each tuple found by the index.
>
> As you note, there's not any really efficient way to make use of
> independent indexes to evaluate an AND condition like this one.
> While Postgres' approach is pretty simplistic, I'm not sure that
> a more-complicated approach would actually be any faster.
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mauricio da Silva Barrios 2000-02-18 13:06:16
Previous Message Karel Zak - Zakkr 2000-02-18 11:27:04 Re: [HACKERS] Date/time types: big change