|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
Re: modifying duplicate unique keys with LOAD DATA INFILE
From: Gerhard Prilmeier (g.prilmeier-lists
web.de)
Date: Wed Oct 05 2005 - 04:36:06 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Dear Michael,
thank you for your response.
>> If a duplicate unique key is found when importing with LOAD DATA INFILE,
> How does that happen? I take it you are adding the imported data into an
> already populated table.
True, that's what I meant to say.
> Don't alter the keys for the existing data!
I see, I should not do that.
> Is it the case that the imported data is simply a set of new rows with no
> references to it? If so, there's no reason to preserve the old key for
> any
> of the imported rows.
Unfortunately, this is not the case. The data in the key has a meaning, it
represents a 64 bit µs timestamp. Is this bad design, would you not do
something like this? This would be one solution: Use an AUTO_INCREMENT key
for identification (I can afford those extra bytes, I just thought I
wouldn't need it.), have the timestamp be non-unique and do as you
described.
> If you already have the exported data and don't want to start over, you
> can
> probably accomplish the same thing with a temporary table.
I don't have the data, I can freely change whatever has to be changed. In
this case I shouldn't go for the temporary table, right? Still, thanks for
your code, I learned from that, too.
Best regards,
Gerhard Prilmeier
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]