Re: [PROPOSAL] Covering + unique indexes.

Поиск
Список
Период
Сортировка
От Teodor Sigaev
Тема Re: [PROPOSAL] Covering + unique indexes.
Дата
Msg-id 55F70D0A.2030503@sigaev.ru
обсуждение исходный текст
Ответ на Re: [PROPOSAL] Covering + unique indexes.  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Ответы Re: [PROPOSAL] Covering + unique indexes.  (Thomas Munro <thomas.munro@enterprisedb.com>)
Список pgsql-hackers
>> CREATE INDEX index ON table (c1, c2, c3) UNIQUE ON (c1, c3);
>>
>> CREATE [UNIQUE {ON FIRST {COLUMN | n_unique_column COLUMNS}} INDEX ON
>> table_name (column_name1, column_name2 ...);
>
> I would use the first (simple) syntax and just throw an error if the
> user tries to skip a column on the UNIQUE clause.
Seems, second option looks as more natural extension of CREATE UNIQUE INDEX


>
> Have you by chance looked to see what other databases have done for
> syntax? I'm guessing this isn't covered by ANSI but maybe there's
> already an industry consensus.

MS SQL and DB/2 suggests (with changes for postgresql):
CREATE UNIQUE INDEX i ON t (a,b) INCLUDE (c)

MS SQL supports both unique and non-unique indexes, DB/2 only unique 
indexes. Oracle/MySQL doesn't support covering indexes. Readed at 
http://use-the-index-luke.com/sql/clustering/index-only-scan-covering-index


MSSQL/DB/2 variants looks good too.

-- 
Teodor Sigaev                      E-mail: teodor@sigaev.ru                                      WWW:
http://www.sigaev.ru/



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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Attach comments to functions' parameters and return value
Следующее
От: Thomas Munro
Дата:
Сообщение: Re: [PROPOSAL] Covering + unique indexes.