index suggestion for 7.4

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема index suggestion for 7.4
Дата
Msg-id 20030530160200.GA22099@wolff.to
обсуждение исходный текст
Ответы Re: index suggestion for 7.4  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: index suggestion for 7.4  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-hackers
Now that expressions can be used in indexes in 7.4 you can have multicolumn
indexes that are ordered in different directions. However the planner
doesn't seem to understand that order by -col asc is the same as order by
col desc (for at least the normal -) so you have to be careful how you
write queries when doing this.

For example:

bruno=> \d test    Table "public.test"Column |  Type   | Modifiers 
--------+---------+-----------col1   | integer | col2   | integer | 
Indexes:   "test1" btree (col1, ((- col2)))

bruno=> explain select col1, col2 from test order by col1 asc, col2 desc;                          QUERY PLAN
               
 
----------------------------------------------------------------Sort  (cost=814.39..839.39 rows=10000 width=8)  Sort
Key:col1, col2  ->  Seq Scan on test  (cost=0.00..150.00 rows=10000 width=8)
 
(3 rows)

bruno=> explain select col1, col2 from test order by col1 asc, -col2 asc;                              QUERY PLAN
                       
 
------------------------------------------------------------------------Index Scan using test1 on test
(cost=0.00..337.50rows=10000 width=8)
 
(1 row)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Practical sets of SQLSTATE values?
Следующее
От: Oleg Bartunov
Дата:
Сообщение: XML and postgres