Re: Bug in nbtree optimization to skip > operator comparisons (or < comparisons in backwards scans)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Bug in nbtree optimization to skip > operator comparisons (or < comparisons in backwards scans)
Дата
Msg-id 997901.1701824030@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Bug in nbtree optimization to skip > operator comparisons (or < comparisons in backwards scans)  (Peter Geoghegan <pg@bowt.ie>)
Ответы Re: Bug in nbtree optimization to skip > operator comparisons (or < comparisons in backwards scans)  (Peter Geoghegan <pg@bowt.ie>)
Список pgsql-hackers
Peter Geoghegan <pg@bowt.ie> writes:
> As I recently went into on the thread where we've been discussing my
> nbtree SAOP patch [1], there is good reason to suspect that one of the
> optimizations added by commit e0b1ee17 is buggy in the presence of an
> opfamily lacking the full set of cross-type comparisons. The attached
> test case confirms that these suspicions were correct. Running the
> tese case against HEAD will lead to an assertion failure (or a wrong
> answer when assertions are disabled).

Hmm ... I had not paid any attention to this commit, but the rationale
given in the commit message is just flat wrong:

    Imagine the ordered B-tree scan for the query like this.

    SELECT * FROM tbl WHERE col > 'a' AND col < 'b' ORDER BY col;

    The (col > 'a') scan key will be always matched once we find the location to
    start the scan.  The (col < 'b') scan key will match every item on the page
    as long as it matches the last item on the page.

That argument probably holds for the index's first column, but it is
completely and obviously wrong for every following column.  Nonetheless
it looks like we're trying to apply the optimization to every scan key.

            regards, tom lane



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

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Bug in nbtree optimization to skip > operator comparisons (or < comparisons in backwards scans)
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: Bug in nbtree optimization to skip > operator comparisons (or < comparisons in backwards scans)