Re: Composite types questions

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: Composite types questions
Дата
Msg-id b42b73151001111019k662cfbc1o66736f8d6877d26f@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Composite types questions  (Vincenzo Romano <vincenzo.romano@notorand.it>)
Ответы Re: Composite types questions  (Vincenzo Romano <vincenzo.romano@notorand.it>)
Список pgsql-general
On Mon, Jan 11, 2010 at 11:08 AM, Vincenzo Romano > SELECT * FROM master_tab
>  WHERE col1>='a date':timestamp AND col1<'another date'::timestamp
> AND col2=42 AND col3='the answer';

queries of this sort are optimally handled via row constructor for 8.2 onwards:

create index col231_idx  on master_tab(col2, col3, col1);

select * from master_tab where (col2,col3,co1) >= (42, 'the answer',
a_date) and (col2,col3,co1) < (42, 'the answer', b_date);

one caveat: the planner is lousy in regards to estimating index
selectivity in these cases which can cause strange behaviors.

regarding constraint_exclusion, I don't think there are any
issues...you should test it to be sure.

merlin

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

Предыдущее
От: Francisco Reyes
Дата:
Сообщение: Using a lock to avoid: could not open relation with OID
Следующее
От: Vincenzo Romano
Дата:
Сообщение: Re: Composite types questions