A
A
astrotrain2015-10-17 14:35:43
MySQL
astrotrain, 2015-10-17 14:35:43

How to increase insert speed in InnoDB table?

Is it possible to increase insert speed in innodb? Myisam table fills up almost instantly with 2 million records, but innodb takes a terribly long time. In contrast, update in myisam is very slow, and in innodb (according to information) much faster. I need to choose one type and set up the database so that both the insertion and the update happen quickly. Can you somehow tweak the settings? Thank you!

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Stanislav Makarov, 2015-10-17
@Nipheris

BEGIN TRANSACTION
-- Insert rows in batches of 10-100K
COMMIT

P
Puma Thailand, 2015-10-17
@opium

Yes, it seems that the updates were faster in Maisame.

A
Aleksey Ratnikov, 2015-10-18
@mahoho

Use INSERT with multiple VALUES:

INSERT INTO table (col1, col2)
VALUES
(1,2),
(3,4),
....

This is much faster than inserting one row at a time - the indexes will be rebuilt once after the transaction completes. Or a faster way - LOAD DATA INFILE, bulk loading of data from an external (local relative to mysqld) file.

S
shagguboy, 2015-10-19
@shagguboy

disable indexes, disable transactional nafik, upload data via LOAD DATA INFILE, enable.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question