Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximum number of columns in a table, which one is correct?

Tags:

sqlite

What is the maximum number of columns in an SQLite3 table? I found an answer:

Maximum Number Of Columns The maximum number of columns is 32767 in a table. The default setting for SQLITE_MAX_COLUMN is 2000.

But I see the error of exceeding maximum number of columns when column number is 1000.

So which one is correct?

like image 261
susanne Avatar asked Oct 20 '25 05:10

susanne


1 Answers

I think you pretty much answered your question your self.

As per the official documentation here here

Maximum Number Of Columns

The SQLITE_MAX_COLUMN compile-time parameter is used to set an upper bound on:

  • The number of columns in a table The number of columns in an index

  • The number of columns in a view The number of terms in the SET clause of an UPDATE statement The number of columns in the result set of a SELECT statement The number of terms in a GROUP BY or ORDER BY clause

  • The number of values in an INSERT statement

The default setting for SQLITE_MAX_COLUMN is 2000. You can change it at compile time to values as large as 32767.

On the other hand, many experienced database designers will argue that a well-normalized database will never need more than 100 columns in a table.

Other use full answer to this you can find it here: How to change SQLITE_MAX_COLUMN in Python?

And here: How to increase column limit of a table in SQLite?

like image 165
Federico Baù Avatar answered Oct 22 '25 05:10

Federico Baù



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!