Re: [HACKERS] OR with multi-key indexes

From: Vadim Mikheev <vadim(at)krs(dot)ru>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] OR with multi-key indexes
Date: 1998-08-03 02:38:03
Message-ID: 35C5228B.3EDCCBB7@krs.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian wrote:
>
> > > create index i_test on test(x,y);
> > > insert into test values(1,2);
> > > select * from test where x=3 and (y=1 or y=2);
>
> > II. Extend multi-key indexing: (y = 1 or y = 2) could be
> > qualified by index access methods itself because of Y is
> > one of index keys. Only first key would be used for finding
> > index tuples but additional qualification could decrease
> > number of heap_fetch calls and this would be nice!
>
> > This feature would be also usefull for:
> >
> > create index on table (a,b,c);
> > select * from table where a = 1 and c = 2;
> > ^^^^^
> > additional qualification would be performed on index level
> >
> > Personally, I would like to see II implemented first because
> > of it works for both query examples.
>
> Doesn't the existing code already use both keys in the above query.
> What is gained by moving this to the index access methods?

I hadn't time to implement this year ago...

Let's say we have 1000 tuples with a = 1 and only 10 with
a = 1 and c = 2 - currently, all 1000 index tuples will be returned
to Executor and all corresponding 1000 heap tuples will be fetched...
Having this feature, only 10 index tuples would be returned
and heap_fetch would be called 10 times only.

Vadim

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas G. Lockhart 1998-08-03 05:16:01 Re: [HACKERS] indexes and floats
Previous Message Mark Nielsen 1998-08-03 02:05:41 won't post here anymore, foudn better