Search Postgresql Archives

Re: Do BRIN indexes support MIN/MAX?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> so you can't deduce in which range the current min or max value is from there.

That is why you select several candidate ranges and scan the table for those ranges.

For instance, if you have ranges
1) 1..4
2) 5..8
3) 6..9

Then you do something like

select x
  from (
    select max(col) x from tab t where rowid in 5..8 or rowid in 6..9
    union all
    selext max(col) x from tab t where rowid in 1..4
  )
 limit 1

If the first two (2 and 3) ranges happen to be empty, then scanning of 1 would be needed.

Of course, it would degrade to scanning all the pages in table if all the ranges intersect or if all the rows are deleted from the table. However, it might work well in timestamp-like cases.

Vladimir

--
Vladimir

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux