Re: Duplicated records deleting between some secs - Mailing list pgsql-novice

From Guy Flaherty
Subject Re: Duplicated records deleting between some secs
Date
Msg-id 23d251df0906251546i5d9a7cc1tdcb58387d546a420@mail.gmail.com
Whole thread Raw
In response to Duplicated records deleting between some secs  (Ruzsinszky Attila <ruzsinszky.attila@gmail.com>)
List 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 by date:

Previous
From: Ruzsinszky Attila
Date:
Subject: Duplicated records deleting between some secs
Next
From: Kindra Martinenko
Date:
Subject: Re: Problems importing csv files