# MySQL notice ! (INSERT INTO) ### Subject Create a table with three columns and import datas of 90000. ### Table | Column 1 | Column 2 | Column 3 | | -------- | -------- | -------- | | Text | Text | Text | ### INSERT INTO :::info INSERT INTO table_name (column1, column2, column3...) VALUES (value1, value2, value3...); ::: :::info INSERT INTO table_name VALUES (value1, value2, value3...); ::: ### Code use Go with gorm ```go=1 count, datas := GetDatas() // count = 90000 db.Create(&datas) ``` :::warning :boom: Error:Prepared statement contains too many placeholders ::: Means you hit the **Row size limits**. ==The internal representation of a MySQL table has a maximum row size limit of 65,535 bytes.== source: https://dev.mysql.com/doc/refman/8.0/en/column-count-limit.html#row-size-limits ### What is the solution ? The maximum row size limit of 65535 bytes, so we can count how many placeholders can we fill in the statement. - Table with 3 columns - 90000 datas 65535 / 3 = 21845 <- **21845** is the answer. We can konw how many insert placeholders are our limit at once. then we use **Create** or **CreateInBatches** ```go=1 db.CreateBatchSize = 21845 db.Create(&datas) ``` Use create must set CreateBatchSize, because initialize GORM with CreateBatchSize option, all INSERT will respect this option when creating record & associations source: https://gorm.io/docs/create.html ```go=1 db.CreateInBatches(&datas,21845) ``` ### In conclusion :::success :whale: You can count how many placeholders insert won't hit the **Row size limits** at once. :::