Re: best way to fetch next/prev record based on index

Поиск
Список
Период
Сортировка
От Markus Schaber
Тема Re: best way to fetch next/prev record based on index
Дата
Msg-id 20040727165044.0549286e@kingfisher.intern.logi-track.com
обсуждение исходный текст
Ответ на best way to fetch next/prev record based on index  ("Merlin Moncure" <merlin.moncure@rcsonline.com>)
Список pgsql-performance
Hi, Merlin,

On Tue, 27 Jul 2004 10:21:32 -0400
"Merlin Moncure" <merlin.moncure@rcsonline.com> wrote:

> The basic problem is the planner can't always match the query to the
> index.  So, either the planner has to be helped/fixed or I have to
> explore another solution.  This seems to happen most when the 'a'
> column has very poor selectivity.  In this case, the planner will only
> examine the 'a' part of the key.

So it may help to add some more indices so you have an index for all permutations,

Create an index on (a,b,c), (a,c,b), (b,c,a), (b,a,c), (c,a,b) and (c,b,a).

So as long as one of the rows has enough selectivity, the planner should
be able to select the correct index. Maybe increasing the number of
random samples for the rows is useful.

HTH,
Markus

--
markus schaber | dipl. informatiker
logi-track ag | rennweg 14-16 | ch 8001 zürich
phone +41-43-888 62 52 | fax +41-43-888 62 53
mailto:schabios@logi-track.com | www.logi-track.com

В списке pgsql-performance по дате отправления:

Предыдущее
От: andrew@pillette.com
Дата:
Сообщение: Re: best way to fetch next/prev record based on index
Следующее
От: "Merlin Moncure"
Дата:
Сообщение: Re: best way to fetch next/prev record based on index