Multicolum index and primary key

Поиск
Список
Период
Сортировка
От Michele Bendazzoli
Тема Multicolum index and primary key
Дата
Msg-id 1069088432.8338.16.camel@mickymouse.sintel
обсуждение исходный текст
Ответы Re: Multicolum index and primary key
Re: Multicolum index and primary key
Re: Multicolum index and primary key
Список pgsql-sql
I wonder if is useless to set some indexes for columns contained in a
multifield primary key.

Suppose by example that one have a table1 with a primary key over three
field (a, b, c): 

ALTER TABLE public.table1 ADD CONSTRAINT table1_pkey PRIMARY KEY(a, b, c);

are the indexes over (a) and (a, b) redundant (and so useless)?

I.e. with other words the question is, if I have a primary key set for
the a, b, c fields the queries 

SELECT 1 from table1 where a='a value'

and

SELECT 1 from table1 where a='a value' AND b='another value'

use the implicit index created by the primary key or not?

Thank you in advance for any advice.

ciao, Michele 

p.s. I know, I'll have to begin to use the explain command ...
I promise I'll do it ;-)



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

Предыдущее
От: Tomasz Myrta
Дата:
Сообщение: Re: strange "not deferrable" behaviour
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Multicolum index and primary key