View Single Post
  #1  
Old 02-21-2003, 12:09 AM
syntoad
Fire Beetle
 
Join Date: Feb 2003
Location: Columbus, OH
Posts: 25
Default Suggestions to make .sql files more efficient

If you make a database that is supposed to override previous databases, it's probally best to use REPLACE instead of INSERT, that way it will actually overwrite the info that is already there (and not give you back so many errors.)

And while I'm at it, it is also desirable to use a multipule insert statement, as it will execute much faster than a lot of inserts.

For example:
Code:
INSERT INTO items VALUES (1001, 'item1001'),
INSERT INTO items VALUES (1002, 'item1002'),
INSERT INTO items VALUES (1003, 'item1003');
becomes:
Code:
REPLACE INTO items VALUES (1001, 'item1001'),
 (1002, 'item1002'),
 (1003, 'item1003');
This should make db upgrades easier and faster.
Reply With Quote