shantanuo
shantanuo

Reputation: 32336

Limit on multiple rows insert

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)

Upvotes: 15

Views: 9286

Answers (2)

Mike Shiyan
Mike Shiyan

Reputation: 304

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.

Upvotes: 6

CL.
CL.

Reputation: 180080

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.

Upvotes: 22

Related Questions