pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
UNIQUE on everything except primary key
3+ messages / 3 participants
[nested] [flat]

* UNIQUE on everything except primary key
@ 2011-02-03 15:44  gvim <gvimrc@gmail.com>
  0 siblings, 2 replies; 3+ messages in thread

From: gvim @ 2011-02-03 15:44 UTC (permalink / raw)
  To: pgsql-sql

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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: UNIQUE on everything except primary key
@ 2011-02-03 15:48  Andreas Gaab <A.Gaab@scanlab.de>
  parent: gvim <gvimrc@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Andreas Gaab @ 2011-02-03 15:48 UTC (permalink / raw)
  To: gvim <gvimrc@gmail.com>; +Cc: pgsql-sql

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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: UNIQUE on everything except primary key
@ 2011-02-04 07:02  msi77 <msi77@yandex.ru>
  parent: gvim <gvimrc@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: msi77 @ 2011-02-04 07:02 UTC (permalink / raw)
  To: gvim <gvimrc@gmail.com>; +Cc: pgsql-sql

Do all the 10 columns make a natural key?

03.02.2011, 18:44, "gvim" <gvimrc@gmail.com>:
> 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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2011-02-04 07:02 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-02-03 15:44 UNIQUE on everything except primary key gvim <gvimrc@gmail.com>
2011-02-03 15:48 ` Andreas Gaab <A.Gaab@scanlab.de>
2011-02-04 07:02 ` msi77 <msi77@yandex.ru>

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