Re: [PERFORM] Slow query: bitmap scan troubles

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [PERFORM] Slow query: bitmap scan troubles
Дата
Msg-id 13842.1357583258@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [PERFORM] Slow query: bitmap scan troubles  (Simon Riggs <simon@2ndQuadrant.com>)
Ответы Re: [PERFORM] Slow query: bitmap scan troubles  (Claudio Freire <klaussfreire@gmail.com>)
Re: [PERFORM] Slow query: bitmap scan troubles  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Simon Riggs <simon@2ndQuadrant.com> writes:
> On 7 January 2013 17:35, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> That gives a formula of
>>    cpu_operator_cost * log2(N) + cpu_operator_cost * 50 * (H+2)

> Again, this depends on N and H, so thats good.

> I think my retinas detached while reading your explanation, but I'm a
> long way from coming up with a better or more principled one.

> If we can describe this as a heuristic that appears to fit the
> observed costs, we may keep the door open for something better a
> little later.

I'm fairly happy with the general shape of this formula: it has a
principled explanation and the resulting numbers appear to be sane.
The specific cost multipliers obviously are open to improvement based
on future evidence.  (In particular, I intend to code it in a way that
doesn't tie the "startup overhead" and "cost per page" numbers to be
equal, even though I'm setting them equal for the moment for lack of a
better idea.)

One issue that needs some thought is that the argument for this formula
is based entirely on thinking about b-trees.  I think it's probably
reasonable to apply it to gist, gin, and sp-gist as well, assuming we
can get some estimate of tree height for those, but it's obviously
hogwash for hash indexes.  We could possibly just take H=0 for hash,
and still apply the log2(N) part ... not so much because that is right
as because it's likely too small to matter.
        regards, tom lane



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

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: [PERFORM] Slow query: bitmap scan troubles
Следующее
От: Claudio Freire
Дата:
Сообщение: Re: [PERFORM] Slow query: bitmap scan troubles