Multicolum index and primary key - Mailing list pgsql-sql

From Michele Bendazzoli
Subject Multicolum index and primary key
Date
Msg-id 1069088432.8338.16.camel@mickymouse.sintel
Whole thread Raw
Responses Re: Multicolum index and primary key  (Peter Eisentraut <peter_e@gmx.net>)
Re: Multicolum index and primary key  (Tomasz Myrta <jasiek@klaster.net>)
Re: Multicolum index and primary key  (Rod Taylor <pg@rbt.ca>)
List 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 by date:

Previous
From: Tomasz Myrta
Date:
Subject: Re: strange "not deferrable" behaviour
Next
From: Peter Eisentraut
Date:
Subject: Re: Multicolum index and primary key