Re: Forcing use of specific index

From: William Yu <wyu(at)talisys(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Forcing use of specific index
Date: 2005-06-03 23:22:49
Message-ID: d7qooc$4pf$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

A pretty awful way is to mangle the sql statement so the other field
logical statements are like so:

select * from mytable where 0+field = 100

Tobias Brox wrote:
> Is it any way to attempt to force the planner to use some specific index
> while creating the plan? Other than eventually dropping all the other
> indices (which is obiously not a solution in production setting anyway)?
>
> I have one case where I have added 16 indices to a table, many of them
> beeing partial indices. The table itself has only 50k of rows, but are
> frequently used in heavy joins. I imagine there can be exponential order on
> the number of alternative paths the planner must examinate as function of
> the number of indices?
>
> It seems to me that the planner is quite often not choosing the "best"
> index, so I wonder if there is any easy way for me to check out what the
> planner think about a specific index :-)
>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Simon Riggs 2005-06-03 23:23:57 Re: Query plan for very large number of joins
Previous Message Morgan 2005-06-03 23:13:21 Insert slow down on empty database