Set cost for a specific index scan

From: Thomas Strunz <beginner_(at)hotmail(dot)de>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Set cost for a specific index scan
Date: 2013-07-18 08:25:39
Message-ID: DUB114-W66B02A150DD17B07CE9A53EE620@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-general by date

  From Date Subject
Next Message Arvind Singh 2013-07-18 10:22:04 new instance of postgres on windows
Previous Message Alban Hertroys 2013-07-18 06:55:25 Re: dynamic table names