Set cost for a specific index scan - Mailing list pgsql-general

From Thomas Strunz
Subject Set cost for a specific index scan
Date
Msg-id DUB114-W66B02A150DD17B07CE9A53EE620@phx.gbl
Whole thread Raw
List pgsql-general
Hi all,

I'm using an open-source "extension"  that creates an index for special type of search and you need to use a custom operator to run queries. Anyway If I run an according query with multiple filters as example also range of primary key  PostgreSQL almost always selects this 3rd party index as the first index to scan. However this index is almost always slower than a "normal" index. This leads to queries with a filter primary_key < 10 taking several seconds because the 3rd party index  taking that much time. In the explain plan it is visible that PostgreSQL seems to prefer this index over other indexes.

Is there any way to increase the cost for this specific index (or operator) so that any other index is always used first?

Beat Regards,

Thomas

pgsql-general by date:

Previous
From: Paul Maddock
Date:
Subject: Postgresql, sql client and I/O exceptions
Next
From: Merlin Moncure
Date:
Subject: Re: Postgresql, sql client and I/O exceptions