Answer the question
In order to leave comments, you need to log in
Why does insert take more than 0.01 seconds?
Good day! I installed clean CentOS 8, Mysql 8.0.17 created a simple table
CREATE TABLE IF NOT EXISTS `service`.`properties` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(150) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `name_UNIQUE` (`name` ASC) VISIBLE)
ENGINE = InnoDB
INSERT INTO properties (name) VALUES (1);
INSERT INTO properties (name) VALUES (2);
INSERT INTO properties (name) VALUES (3);
...
Answer the question
In order to leave comments, you need to log in
Wrap all inserts in a transaction.
To avoid confusion: the right example of how to wrap INSERTs in a transaction
This will be faster
INSERT INTO properties (name) VALUES
(1),
(2),
(3),
(4),
...
(10000);
because you need to prepare a request and wrap it in a transaction
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question