From: | Michele Bendazzoli <mickymouse(at)mickymouse(dot)it> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Multicolum index and primary key |
Date: | 2003-11-17 17:00:32 |
Message-ID: | 1069088432.8338.16.camel@mickymouse.sintel |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 ;-)
From | Date | Subject | |
---|---|---|---|
Next Message | Michele Bendazzoli | 2003-11-17 17:33:56 | Re: Multicolum index and primary key |
Previous Message | Rod Taylor | 2003-11-17 16:23:17 | Re: Multicolum index and primary key |