pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Arnau <arnaulist@andromeiberica.com>
To: PostgreSQL Performance <pgsql-performance@postgresql.org>
Subject: Does it matters the column order in indexes and constraints creation?
Date: Thu, 11 Jan 2007 11:56:50 +0100
Message-ID: <45A617F2.6040802@andromeiberica.com> (raw)

Hi all,

   I've got a doubt about how to create an index and a primary key. Lets 
say I have the following table:

   CREATE TABLE blacklist
   (
     telephone    VARCHAR(15),
     customer_id    INT4
                  CONSTRAINT fk_blacklist_customerid REFERENCES
                    customers( customer_id ),
     country_id     INT2
                  CONSTRAINT fk_blacklist_countryid REFERENCES
                    countries( country_id ),
                  CONSTRAINT pk_blacklist_cidcustidtel
                    PRIMARY KEY(country_id, customer_id, telephone)
   );

   The country_id column can have maybe 100 - 250 different values.
   The customer_id column can have as much several hundred values (less 
than 1000).
   The telephone is where all will be different.

   So my doubt is, in terms of performance makes any difference the 
order of the primary key fields? The same in the index definition? I 
have checked the postgresql documentation I haven't been able to find 
anything about.

Thanks
-- 
Arnau



view thread (2+ messages)  latest in thread

Message-ID: <45A617F2.6040802@andromeiberica.com>
Permalink:  ../45A617F2.6040802@andromeiberica.com/
Also on:    postgresql.org/message-id/45A617F2.6040802@andromeiberica.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: arnaulist@andromeiberica.com
  Subject: Re: Does it matters the column order in indexes and constraints creation?
  In-Reply-To: <45A617F2.6040802@andromeiberica.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox