Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get the size of a record in mysql

Tags:

mysql

How to get the size of a record in MySql if the table contains fields of type TEXT or BLOB?

is it possible to get the size of a record or table using sql statement?

like image 406
Osama Avatar asked Apr 03 '10 09:04

Osama


People also ask

How do I determine row size in MySQL?

How can we determine the size of a given table in a given schema? SELECT table_name "Table Name", table_rows "Rows Count", round(((data_length + index_length)/1024/1024),2) "Table Size (MB)" FROM information_schema.

How do you calculate database record size?

Determine the size, then the average number of occurrences of each segment type in a database record. By multiplying these two numbers together, you get the size of an average database record.

What is row size?

Row Size Limits. The maximum row size for a given table is determined by several factors: The internal representation of a MySQL table has a maximum row size limit of 65,535 bytes, even if the storage engine is capable of supporting larger rows.


1 Answers

To calculate the size of a string or blob in bytes, use LENGTH(YourColumn).

To calculate the number of characters in a text string, use CHAR_LENGTH(YourTextColumn).

like image 90
Mark Byers Avatar answered Nov 04 '22 08:11

Mark Byers