MySQL Forums
Forum List  »  MyISAM

Re: manually create myisam table .myd .frm files
Posted by: Rick James
Date: January 29, 2011 03:58PM

Have your generating program generate and execute
INSERT INTO foo (a,b,c) VALUES
(1,2,3),
(11,22,33),
...
;
Do that in batches of 100 (the recommended number) rows per INSERT statement. This will come close to LOAD DATA speed. (Batches of 1000 won't be significantly faster; too big a batch will hit some limit.)

SHOW CREATE TABLE \G
What INDEXes do you have?

Sorting the data in PRIMARY KEY order will help speed up the INSERTs.

SHOW VARIABLES LIKE '%buffer%';
key_buffer_size should probably be 20% of available RAM.

DELAYED_KEY_WRITE may help.

Loading into a MyISAM table with _no_ indexes (not even PK), then ALTER TABLE to add the indexes may help.

Another approach...
1. CREATE TABLE foo (...) ENGINE=csv;
2. Generate the .csv file in the database directory.
3. ALTER TABLE foo
PRIMARY KEY (...),
INDEX ... ENGINE = MyISAM;
(Read about CSV files, make sure you have that Engine available, etc)
SHOW VARIABLES LIKE 'have%';

Options: ReplyQuote


Subject
Views
Written By
Posted
5300
P R
January 27, 2011 04:31PM
Re: manually create myisam table .myd .frm files
3407
January 29, 2011 03:58PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.