Re: [PROPOSAL] Covering + unique indexes.

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: [PROPOSAL] Covering + unique indexes.
Дата
Msg-id CAKJS1f-3op5KuH5PZcz3Whf1HSdOv8Jp6mpUSBA0J_fk8cHNQA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [PROPOSAL] Covering + unique indexes.  (Teodor Sigaev <teodor@sigaev.ru>)
Ответы Re: [PROPOSAL] Covering + unique indexes.  (Vik Fearing <vik@2ndquadrant.fr>)
Re: [PROPOSAL] Covering + unique indexes.  (Nicolas Barbier <nicolas.barbier@gmail.com>)
Список pgsql-hackers
On 15 September 2015 at 18:16, Teodor Sigaev <teodor@sigaev.ru> wrote:
CREATE INDEX ... ON table (f1, f2, f3) UNIQUE(f1, f2) INCLUDE(f4);

I don't see an advantage this form. What is f3 column? just order? and f4 will not be used for compare?  At least now it requires additional checks that UNIQUE() fields are the same as first columns in definition. Non ordering field f4 will  require invasive intervention in planner because now it believes that all columns in btree are ordered.       


I'm also a bit confused where f3 comes in here. If it's UNIQUE on (f1,f2) and we include f4. Where's f3?  
 
I agree, that form
CREATE UNIQUE INDEX i ON t (f1, f2, f3) INCLUDE (f4)
is clear. f4 will be used in row compare and actually planner will be able to use it as unique index (f1, f2, f3) with additional f4 or as
as unique index (f1, f2, f3, f4), because uniqueness on (f1, f2, f3) gives warranty of uniqueness on (f1, f2, f3, f4)


I'd vote for this too. However, INCLUDE does not seem to be a reserved word at the moment.

I think this syntax fits in nicely to with non-unique indexes too.

Regards

David Rowley

--
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services
 

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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: pg_hba_lookup function to get all matching pg_hba.conf entries
Следующее
От: "Shulgin, Oleksandr"
Дата:
Сообщение: Re: On-demand running query plans using auto_explain and signals