![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 238 Pomógł: 0 Dołączył: 6.05.2011 Ostrzeżenie: (10%) ![]() ![]() |
Witam,
Muszę usunąć duplikaty z 1,6mln rekordów.. Zastanawiam się jak to zrobić najszybciej. Duplikaty mają się usuwać wierszami, czyli duplikaty jeśli jeden wiersz nie może się równać innemu. Macie jakieś propozycje jak to zrobić? Proszę o szybka odpowiedź. |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 898 Pomógł: 80 Dołączył: 31.05.2008 Ostrzeżenie: (20%) ![]() ![]() |
Z http://dev.mysql.com/doc/refman/5.0/en/delete.html lekko przerobione:
Cytat If you are deleting many rows from a large table, you may exceed the lock table size for an InnoDB table. To avoid this problem, or simply to minimize the time that the table remains locked, the following strategy (which does not use DELETE at all) might be helpful:
Select the rows not to be deleted into an empty table that has the same structure as the original table: Kod INSERT INTO t_copy SELECT DISTINCT * FROM t; Use RENAME TABLE to atomically move the original table out of the way and rename the copy to the original name: Kod RENAME TABLE t TO t_old, t_copy TO t; Drop the original table: Kod DROP TABLE t_old; |
|
|
![]() ![]() |
![]() |
Aktualny czas: 17.10.2025 - 23:03 |