Insert in Mariadb giving timeout

Asked

Viewed 142 times

1

What are the reasons that the simple Insert described below would take so long that it even gives timeout on the server?

INSERT INTO wkvmk_postmeta (post_id, meta_key, meta_value) VALUES(904, '_order_key', '')

Table structure:

+------------+---------------------+------+-----+---------+----------------+
| Field      | Type                | Null | Key | Default | Extra          |
+------------+---------------------+------+-----+---------+----------------+
| meta_id    | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| post_id    | bigint(20) unsigned | NO   | MUL | 0       |                |
| meta_key   | varchar(255)        | YES  | MUL | NULL    |                |
| meta_value | longtext            | YES  |     | NULL    |                |
+------------+---------------------+------+-----+---------+----------------+

Amount of records already recorded: 5729

Server type: MariaDB

Server version: 10.0.24-MariaDB - MariaDB Server

Protocol version: 10

Error message: ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction

Making Insert directly with a client on the console (mariadb-client-10.0)

  • Are you using any language? the amount of Insert then is 5729 lines?

  • 1

    @Virgilionovic edited the question answering your questions :)

1 answer

1


Make sure your connection is not running any process that may be affecting your database:

SHOW FULL PROCESSLIST;

You can kill the process using the command:

KILL [ID_PROCESSO]

A transaction started that did not receive a commit may lock a process and kill him as described above resolves!

  • Still on this subject, I have the same problem, only in the update. In the table Insert works, I have already checked my code and the transaction is closed. I have entered the mysql console, and even the mysql console gives the error. Where condition has only a date and a "situation" field. What else could it be?

  • Does the table have many records? The fields you are using in WHERE are indexed?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.