-->

Limit on multiple rows insert

2019-01-27 20:13发布

问题:

Since version 3.7.11 SQLite supports enhanced INSERT syntax to allow multiple rows to be inserted via the VALUES clause.

http://www.sqlite.org/releaselog/3_7_11.html

Is there any limit on how many values can be inserted in a single statement? (for e.g. 500)

回答1:

SQLite handles a multi-row INSERT like a compound SELECT. The limit for that is indeed 500.

However, since version 3.8.8,

the number of rows in a VALUES clause is no longer limited by SQLITE_LIMIT_COMPOUND_SELECT.



回答2:

According to the official documentation, there are some limits actually:

  1. Maximum Length Of An SQL Statement

    The maximum number of bytes in the text of an SQL statement is limited to SQLITE_MAX_SQL_LENGTH which defaults to 1000000 bytes.

  2. Maximum Number Of Host Parameters In A Single SQL Statement

    The number of host parameters (aka tokens) - either named, unnamed or numbered - is limited to SQLITE_MAX_VARIABLE_NUMBER, which defaults to 999 items.