pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas Gaab <A.Gaab@scanlab.de>
To: gvim <gvimrc@gmail.com>
Cc: pgsql sql <pgsql-sql@postgresql.org>
Subject: Re: UNIQUE on everything except primary key
Date: Thu, 3 Feb 2011 16:48:23 +0100
Message-ID: <48DA836F3865C54B8FBF424A3B775AF6671A683922@Exchange-Server> (raw)
In-Reply-To: <4D4ACD57.1090508@gmail.com>
References: <4D4ACD57.1090508@gmail.com>

Did you check check constraints?
http://www.postgresql.org/docs/8.4/static/ddl-constraints.html

Best
Andreas

-----Ursprüngliche Nachricht-----
Von: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] Im Auftrag von gvim
Gesendet: Donnerstag, 3. Februar 2011 16:44
An: pgsql sql
Betreff: [SQL] UNIQUE on everything except primary key

I have a table with 11 columns and want to eliminate duplication on INSERTs. What's the best method? The obvious solution would be to create a UNIQUE index on everything except the primary key - 'id' - but that's a 10-column index and doesn't sound very efficient. Am I missing something more obvious?

gvim

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (3+ messages)  latest in thread

Message-ID: <48DA836F3865C54B8FBF424A3B775AF6671A683922@Exchange-Server>
Permalink:  ../48DA836F3865C54B8FBF424A3B775AF6671A683922@Exchange-Server/
Also on:    postgresql.org/message-id/48DA836F3865C54B8FBF424A3B775AF6671A683922@Exchange-Server

 · 

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-sql@postgresql.org
  Cc: A.Gaab@scanlab.de, gvimrc@gmail.com
  Subject: Re: UNIQUE on everything except primary key
  In-Reply-To: <48DA836F3865C54B8FBF424A3B775AF6671A683922@Exchange-Server>

* 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