pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
why can't 2 indexes be used at once?
2+ messages / 2 participants
[nested] [flat]

* why can't 2 indexes be used at once?
@ 2004-04-29 23:19  Joseph Shraibman <jks@selectacast.net>
  0 siblings, 1 reply; 2+ messages in thread

From: Joseph Shraibman @ 2004-04-29 23:19 UTC (permalink / raw)
  To: pgsql-performance

Lets say I have two columns, A and B.  They are each indexed seperately. 
  If I do a query like:
SELECT * FROM table WHERE A = 1 AND B = 2;
postgres can only use one index.

I assume that postgres uses the index data to narrow down pages in the 
table to visit when doing its search. Then it goes through and filters 
on the second condition.

My question: why can't it go through the first index, get a list of 
pages in the table, then go through the second index, union the result 
with the results from first index, and then go into the table?



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: why can't 2 indexes be used at once?
@ 2004-04-30 03:57  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Joseph Shraibman <jks@selectacast.net>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2004-04-30 03:57 UTC (permalink / raw)
  To: Joseph Shraibman <jks@selectacast.net>; +Cc: pgsql-performance

Joseph Shraibman <jks@selectacast.net> writes:
> My question: why can't it go through the first index, get a list of 
> pages in the table, then go through the second index, union the result 
> with the results from first index, and then go into the table?

See TODO list ...

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2004-04-30 03:57 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-04-29 23:19 why can't 2 indexes be used at once? Joseph Shraibman <jks@selectacast.net>
2004-04-30 03:57 ` Tom Lane <tgl@sss.pgh.pa.us>

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