Index ordering after IS NULL

Поиск
Список
Период
Сортировка
От Jeff Janes
Тема Index ordering after IS NULL
Дата
Msg-id CAMkU=1xSOGCwyJ9d+g9B7WA9qv5k_wKskhihB6uNi3TG65Pyog@mail.gmail.com
обсуждение исходный текст
Ответы Re: Index ordering after IS NULL  (Peter Geoghegan <pg@bowt.ie>)
Re: Index ordering after IS NULL  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On a two-column btree index, we can constrain the first column with equality and read the rows in order by the 2nd column.  But we can't constrain the first column by IS NULL and still read the rows in order by the 2nd column.  But why not?  Surely the structure of the btree index would allow for this to work.

Example:

create table if not exists j as select case when random()<0.9 then floor(random()*10)::int end b, random() c from generate_series(1,1000000);
create index if not exists j_b_c_idx on j (b,c);
set enable_sort TO off;
explain analyze select * from j where b is null order by c limit 10;
explain analyze select * from j where b =8 order by c limit 10;
 
The first uses a sort despite it being disabled.

Cheers,

Jeff

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

Предыдущее
От: Nathan Bossart
Дата:
Сообщение: Re: archive modules
Следующее
От: Michael Banck
Дата:
Сообщение: Re: Support load balancing in libpq