Re: [GENERAL] Difference between UNIQUE constraint vs index

2007-02-28 Thread Brandon Aiken
:03 AM To: Brandon Aiken Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Difference between UNIQUE constraint vs index "Brandon Aiken" <[EMAIL PROTECTED]> writes: > SQLite, MySQL, and MS Access each use indexes for unique constraints. > Doesn't the SQL spec speci

Re: [GENERAL] Difference between UNIQUE constraint vs index

2007-02-28 Thread John Jawed
Informix: http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.sqls.doc/sqls285.htm AFAICS, Oracle as well. John On 2/28/07, Tom Lane <[EMAIL PROTECTED]> wrote: "Jim C. Nasby" <[EMAIL PROTECTED]> writes: > In some databases if you know that an index just happens to be

Re: [GENERAL] Difference between UNIQUE constraint vs index

2007-02-28 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 02/28/07 10:31, Joshua D. Drake wrote: I would imagine that other DBMSes also enforce uniqueness by means of indexes, because it'd be awful darn expensive to enforce the constraint without one; but I'm only guessing here, not having l

Re: [GENERAL] Difference between UNIQUE constraint vs index

2007-02-28 Thread Joshua D. Drake
>>> I would imagine that other DBMSes also enforce uniqueness by means of >>> indexes, because it'd be awful darn expensive to enforce the constraint >>> without one; but I'm only guessing here, not having looked. Can anyone >>> point to a real system that enforces unique constraints without an >

Re: [GENERAL] Difference between UNIQUE constraint vs index

2007-02-28 Thread Tom Lane
"Brandon Aiken" <[EMAIL PROTECTED]> writes: > SQLite, MySQL, and MS Access each use indexes for unique constraints. > Doesn't the SQL spec specify that CREATE INDEX can be used to create > UNIQUE indexes? No, there is no such command in the SQL spec. In fact the concept of an index does not appea

Re: [GENERAL] Difference between UNIQUE constraint vs index

2007-02-28 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 02/28/07 00:16, Tom Lane wrote: > "Jim C. Nasby" <[EMAIL PROTECTED]> writes: >> In some databases if you know that an index just happens to be unique >> you might gain some query performance by defining the index as unique, >> but I don't think the

Re: [GENERAL] Difference between UNIQUE constraint vs index

2007-02-28 Thread Brandon Aiken
EMAIL PROTECTED] On Behalf Of Tom Lane Sent: Wednesday, February 28, 2007 1:17 AM To: Jim C. Nasby Cc: John Jawed; pgsql-general@postgresql.org Subject: Re: [GENERAL] Difference between UNIQUE constraint vs index "Jim C. Nasby" <[EMAIL PROTECTED]> writes: > In some databa

Re: [GENERAL] Difference between UNIQUE constraint vs index

2007-02-27 Thread Tom Lane
"Jim C. Nasby" <[EMAIL PROTECTED]> writes: > In some databases if you know that an index just happens to be unique > you might gain some query performance by defining the index as unique, > but I don't think the PostgreSQL planner is that smart. Actually, the planner only pays attention to whether

Re: [GENERAL] Difference between UNIQUE constraint vs index

2007-02-27 Thread Jim C. Nasby
Adding -general back in. On Tue, Feb 27, 2007 at 07:19:15PM -0600, John Jawed wrote: > This is more or less correct, I was looking for performance gains on > the [possible] differences during DML and DDL. > > If Jim is correct, is there a particular reason that PostgreSQL does > not behave like o

Re: [GENERAL] Difference between UNIQUE constraint vs index

2007-02-27 Thread John Jawed
This is more or less correct, I was looking for performance gains on the [possible] differences during DML and DDL. If Jim is correct, is there a particular reason that PostgreSQL does not behave like other RDBMs without a SET ALL DEFERRED? Or is this a discussion best left for -HACKERS? On 2/27

Re: [GENERAL] Difference between UNIQUE constraint vs index

2007-02-27 Thread Joshua D. Drake
John Jawed wrote: > Is there any difference as far as when the "uniqueness" of values is > checked in DML between a unique index vs a unique constraint? Or is > the only difference syntax between unique indices and constraints in > PostgreSQL? They are functionally the same and unique constraint w

Re: [GENERAL] Difference between UNIQUE constraint vs index

2007-02-27 Thread Jim C. Nasby
On Tue, Feb 27, 2007 at 06:43:51PM -0600, John Jawed wrote: > Is there any difference as far as when the "uniqueness" of values is > checked in DML between a unique index vs a unique constraint? Or is > the only difference syntax between unique indices and constraints in > PostgreSQL? Syntax only,