Re: PATCH: Using BRIN indexes for sorted output
От | Tomas Vondra |
---|---|
Тема | Re: PATCH: Using BRIN indexes for sorted output |
Дата | |
Msg-id | b8a4e04c-c091-056c-a379-11d35c7b2d8d@enterprisedb.com обсуждение исходный текст |
Ответ на | Re: PATCH: Using BRIN indexes for sorted output (Alvaro Herrera <alvherre@alvh.no-ip.org>) |
Ответы |
Re: PATCH: Using BRIN indexes for sorted output
|
Список | pgsql-hackers |
On 2/24/23 09:39, Alvaro Herrera wrote: > On 2023-Feb-23, Matthias van de Meent wrote: > >>> + for (heapBlk = 0; heapBlk < nblocks; heapBlk += pagesPerRange) >> >> I am not familiar with the frequency of max-sized relations, but this >> would go into an infinite loop for pagesPerRange values >1 for >> max-sized relations due to BlockNumber wraparound. I think there >> should be some additional overflow checks here. > > They are definitely not very common -- BlockNumber wraps around at 32 TB > IIUC. But yeah, I guess it is a possibility, and perhaps we should find > a way to write these loops in a more robust manner. > I guess the easiest fix would be to do the arithmetic in 64 bits. That'd eliminate the overflow. Alternatively, we could do something like prevHeapBlk = 0; for (heapBlk = 0; (heapBlk < nblocks) && (prevHeapBlk <= heapBlk); heapBlk += pagesPerRange) { ... prevHeapBlk = heapBlk; } regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
В списке pgsql-hackers по дате отправления: