Re: Duplicated records deleting between some secs

Поиск
Список
Период
Сортировка
От Guy Flaherty
Тема Re: Duplicated records deleting between some secs
Дата
Msg-id 23d251df0906251546i5d9a7cc1tdcb58387d546a420@mail.gmail.com
обсуждение исходный текст
Ответ на Duplicated records deleting between some secs  (Ruzsinszky Attila <ruzsinszky.attila@gmail.com>)
Список pgsql-novice


On Fri, Jun 26, 2009 at 7:38 AM, Ruzsinszky Attila <ruzsinszky.attila@gmail.com> wrote:
Hi,

As we found there is a bug in my program.
In some days ago the records arrived duplicated with some secs difference in
timestamp. (the difference can be 0s, too) Not all records are
duplicated, because
the problem is the first part of the input stream, so there are
records which aren't
duplicated.

How can I delete the records which arrived later?

I would'nt like miss or drop  the original records.

TIA,
Ruzsi

It is a little difficult to help you with only this information. How many records are in your table? What is your primary key structure? Do you need to delete them whilst the table is 'live', ie. records are constantly being updated/inserted etc, or can you afford to just fix the records without having to worry about the table being used for anything else?

You might be able to delete the records by using min(timestamp) to get the earliest inserted records. You could push these into a temp copy of your table, truncate the main table and then copy them back in from the temp table. It would be easier to tell with more information about your data and table.

Guy Flaherty

В списке pgsql-novice по дате отправления:

Предыдущее
От: Ruzsinszky Attila
Дата:
Сообщение: Duplicated records deleting between some secs
Следующее
От: Kindra Martinenko
Дата:
Сообщение: Re: Problems importing csv files