Skip site navigation (1) Skip section navigation (2)

why can't 2 indexes be used at once?

From: Joseph Shraibman <jks(at)selectacast(dot)net>
To: pgsql-performance(at)postgresql(dot)org
Subject: why can't 2 indexes be used at once?
Date: 2004-04-29 23:19:09
Message-ID: c6s2ha$1l21$1@news.hub.org (view raw or flat)
Thread:
Lists: 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?

Responses

pgsql-performance by date

Next:From: Joseph ShraibmanDate: 2004-04-29 23:24:40
Subject: Re: Insert only tables and vacuum performance
Previous:From: Tom LaneDate: 2004-04-29 23:17:49
Subject: Re: planner/optimizer question

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group