Re: Dublicates pairs in a table. - Mailing list pgsql-sql

From Richard Huxton
Subject Re: Dublicates pairs in a table.
Date
Msg-id 200209171107.33845.dev@archonet.com
Whole thread Raw
In response to Re: Dublicates pairs in a table.  ("Ries van Twisk" <ries@jongert.nl>)
List pgsql-sql
On Tuesday 17 Sep 2002 7:36 am, Ries van Twisk wrote:
> Richard,
>
> do you suggest using a stored procedure to handle this? I do expect that
> the table will be large (for me large is a around 10000-20000 records, the
> table as more columns but I only need the restriction on c1 & c2) but I
> don’t expect lots of inserts and deletes. Data entry will be done using a
> regular user but of course a update needs to be done within a acceptable
> time so the user does not get annoyed.

I'd go with the UNIQUE INDEX. You're unlikely to be able to write code any
faster than the built-in indexing code. It's also simpler and easier for
someone else to see what's going on.

The only time the index will slow you down is on an insert/delete when the
index needs to be updated as well as the table. However, without the index
you'll need to scan the table to check for duplicates. For thousands of
records that can only be slower.

To put your mind at ease, I'd put together some test data and try it - nothing
like seeing some real evidence.

HTH

- Richard Huxton


pgsql-sql by date:

Previous
From: "Ries van Twisk"
Date:
Subject: Re: Dublicates pairs in a table.
Next
From: Roland Roberts
Date:
Subject: Re: How to select and result row number??