Get the App
SLTechnology News&Howtos  ›  Database  › 

How to implement batch insertion in Mysql

Shulou Source: shulou.com Published: 2022-05-31 19:18:12 10月28日 Update

This article shows you how to achieve batch insertion in Mysql, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

1. Create a test table:

Create table t_emp (id int (8), SNO int (8))

two。 Create PROCEDURE

DELIMITER / /

CREATE PROCEDURE test_insert ()

BEGIN

DECLARE i INT DEFAULT 0

WHILE iCALL test_insert ()

ERROR 1436 (HY000): Thread stack overrun: 10880 bytes used of a 131072 byte stack, and 128000 bytes needed. Use 'mysqld-- thread_stack=#' to specify a bigger stack.

Treatment method:

Modify the configuration file: comment out the line thread_stack = 128K, or change a larger value, and then restart mysql.

1. Modify: my.cnf

Thread_stack = 500K

2.service mysqld restart

[root@db11g etc] # service mysqld restart

Shutting down MySQL.. [OK]

Starting MySQL.. [OK]

The above is how to achieve batch insertion in Mysql. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Tags: Procedures storage semicolons statements content skills knowledge symbols concise concise so that notes that is values files articles methods more comments articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB NVidia OPPO Reno MySQL Apple