| From: | "Carlo Stonebanks" <stonec(dot)register(at)sympatico(dot)ca> | 
|---|---|
| To: | <pgsql-performance(at)postgresql(dot)org> | 
| Subject: | Composite keys | 
| Date: | 2011-10-11 15:16:07 | 
| Message-ID: | CCB4B01D184042ECBBE456D1ACB185A4@CAPRICA | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-performance | 
Excuse the noob question, I couldn't find any reading material on this
topic.
Let's say my_table has two fields, pkey_id and another_id. The primary key
is pkey_id and of course indexed.
Then someone adds a composite index on btree(pkey_id, another_id).
Question 1) Is there any benefit to having pkey_id in the second index
(assuming the index was created to satisfy some arbitrary WHERE clause)?
Question 2) Regardless of the answer to Question 1 - if another_id is not
guaranteed to be unique, whereas pkey_id is - there any value to changing
the order of declaration (more generally, is there a performance impact for
column ordering in btree composite keys?)
Thanks,
Carlo
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Greg Smith | 2011-10-11 15:32:48 | Re: Adding more memory = hugh cpu load | 
| Previous Message | Luca Tettamanti | 2011-10-11 12:50:55 | Re: Adding more memory = hugh cpu load |