Mike Baranczak
Mike Baranczak

Reputation: 8374

How to get maximum size of MySQL row?

I tried creating a table, and got the "Row size too large" error. No problem, I just changed some of the large VARCHAR fields to TEXT, and it worked. But now I have no idea how close I am to the row size limit. How do I determine the maximum row size for a table?

MySQL version: 5.5.

Upvotes: 2

Views: 5222

Answers (2)

RTB
RTB

Reputation: 5823

It depends on the storage engine you use and the row format chosen for that table, and also your indexes. It's hard to calculate because the database is able to constantly change its structure.

But the VARCHAR, TEXT and BLOB are a variable-length data types, it has a length property, but the value can be empty; calculation may be not exact. Have a look at Avg_row_length field in information_schema.tables.

EDIT: Have a look at: Data Type Storage Requirements.

Upvotes: 1

tadman
tadman

Reputation: 211610

There's some rough guidelines in the MySQL documentation on row-size limits that might help.

Remember that bytes and characters are not equivalent. A VARCHAR(255) in a UTF-8 type table will count as more than one byte per character. By default three bytes are reserved.

Upvotes: 0

Related Questions