Re: Dublicates pairs in a table.

From: Richard Huxton <dev(at)archonet(dot)com>
To: <ries(at)jongert(dot)nl>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Dublicates pairs in a table.
Date: 2002-09-17 10:07:33
Message-ID: 200209171107.33845.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Roland Roberts 2002-09-17 14:14:58 Re: How to select and result row number??
Previous Message Ries van Twisk 2002-09-17 06:36:36 Re: Dublicates pairs in a table.