no lssi no lssi wrote:
I make this mysql script:
That script copies the entire table around twice. I'm curious to know how long that took (but then again, I don't really know how large the table is at all).
Much more efficient would be:
ALTER TABLE image ADD COLUMN tmp_id int auto_increment; ALTER TABLE image ADD UNIQUE INDEX (tmp_id); DELETE FROM image WHERE tmp_id IN (SELECT i2.tmp_id FROM image i1, image i2 WHERE i1.tmp_id<i2.tmp AND i1.img_name=i2.img_name); ALTER TABLE image DROP COLUMN tmp_id;
though I haven't tried if this works on MySQL.
Timwi