Thread: Duplicated records deleting between some secs
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
On Fri, Jun 26, 2009 at 7:38 AM, Ruzsinszky Attila <ruzsinszky.attila@gmail.com> wrote:
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
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