Re: Dublicates pairs in a table.

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Dublicates pairs in a table.
Дата
Msg-id 200209171107.33845.dev@archonet.com
обсуждение исходный текст
Ответ на Re: Dublicates pairs in a table.  ("Ries van Twisk" <ries@jongert.nl>)
Список 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 по дате отправления:

Предыдущее
От: "Ries van Twisk"
Дата:
Сообщение: Re: Dublicates pairs in a table.
Следующее
От: Roland Roberts
Дата:
Сообщение: Re: How to select and result row number??