specify whitch index to use

From: "pgsql-general(at)list(dot)coretech(dot)ro" <pgsql-general(at)list(dot)coretech(dot)ro>
To: pgsql-general(at)postgresql(dot)org
Subject: specify whitch index to use
Date: 2006-11-12 16:36:52
Message-ID: 45574DA4.9090206@list.coretech.ro
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


hello,

I have two indexes on a table on cols col1 and col2, the table has ~10M
rows on pg v8.1.4

when I use "where col1 = val1" the query is fast and returns 0 rows
when I use "where col2 > val2" the query is slow and returns ~1M rows

in both cases the corresponding indexes are used.
when I use "where col1 = val1 and col2 > val2" the query is slow and
returns 0 rows using the index on col2

is there any way for postgres to use both indexes when relevant columns
are present in a where clause ?
is it possible to specify which index to use in a query ?

thanks,
razvan radu

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Kretschmer 2006-11-12 16:47:40 Re: specify whitch index to use
Previous Message Chris Mair 2006-11-12 16:26:42 Re: Why isn't it allowed to create an index in a schema