> 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

Reply via email to