From: Joseph Shraibman <jks@selectacast.net>
To: pgsql-performance@postgresql.org
Subject: why can't 2 indexes be used at once?
Date: Thu, 29 Apr 2004 19:19:09 -0400
Message-ID: <c6s2ha$1l21$1@news.hub.org> (raw)
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?
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: jks@selectacast.net
Subject: Re: why can't 2 indexes be used at once?
In-Reply-To: <c6s2ha$1l21$1@news.hub.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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