Visa ett inlägg
Oläst 2009-02-19, 17:29 #11
Magnus_A Magnus_A är inte uppkopplad
Klarade millennium-buggen
 
Reg.datum: May 2006
Inlägg: 2 604
Magnus_A Magnus_A är inte uppkopplad
Klarade millennium-buggen
 
Reg.datum: May 2006
Inlägg: 2 604
Det lustiga är att jag gör en replace into måltabell select * from källtabell med totalt ca 10 000 rader i tre olika tabellpar och det går på ca 5 sekunder totalt. Men då kör jag inte delayed, eftersom ingen skriver i databasen utom jag.

Frågan är hur mycket du behöver delayed.

Intressant kommentar i Mysql-manualen:

Citat:
Performance considerations: *Please note that REPLACE INTO is a much slower performer than an UPDATE statement. Keep in mind that a REPLACE INTO requires a test on the keys, and if a matching unique key is found on any or all columns, a DELETE FROM is executed, then an INSERT is executed. There's a lot of management of rows involved in this, and if you're doing it frequently, you'll hurt your performance unless you simply cannot do with any other syntax. *The only time when I can see where you'd actually need a REPLACE INTO is when you have multiple unique constraints on a table, and need to drop any rows that would match any of the constraints. Then REPLACE INTO becomes more efficient from DELETE FROM... INSERT INTO... *If you're looking at a single unique column table (Primary Key), please use UPDATE, or INSERT. Also, check out INSERT ... ON DUPLIATE KEY UPDATE... as an alternative if you're willing to stick to MySQL 4.1+
Magnus_A är inte uppkopplad   Svara med citatSvara med citat