Re: PATCH: Using BRIN indexes for sorted output

Поиск
Список
Период
Сортировка
От Matthias van de Meent
Тема Re: PATCH: Using BRIN indexes for sorted output
Дата
Msg-id CAEze2WjXHXcfK+SRi3pwkXounPrrW=GM62-pOBrnHOAAivoKXw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: PATCH: Using BRIN indexes for sorted output  (Tomas Vondra <tomas.vondra@enterprisedb.com>)
Список pgsql-hackers
On Fri, 24 Feb 2023 at 17:04, Tomas Vondra
<tomas.vondra@enterprisedb.com> wrote:
>
> On 2/24/23 16:14, Alvaro Herrera wrote:
> > ... if pagesPerRange is not a whole divisor of MaxBlockNumber, I think
> > this will neglect the last range in the table.
> >
>
> Why would it? Let's say BlockNumber is uint8, i.e. 255 max. And there
> are 10 pages per range. That's 25 "full" ranges, and the last range
> being just 5 pages. So we get into
>
>    prevHeapBlk = 240
>    heapBlk = 250
>
> and we read the last 5 pages. And then we update
>
>    prevHeapBlk = 250
>    heapBlk = (250 + 10) % 255 = 5
>
> and we don't do that loop. Or did I get this wrong, somehow?

The result is off-by-one due to (u)int8 overflows being mod-256, but
apart from that your result is accurate.

The condition only stops the loop when we wrap around or when we go
past the last block, but no earlier than that.


Kind regards,

Matthias van de Meent



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

Предыдущее
От: Tomas Vondra
Дата:
Сообщение: Re: PATCH: Using BRIN indexes for sorted output
Следующее
От: Sébastien Lardière
Дата:
Сообщение: Re: Timeline ID hexadecimal format