Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL - querying average row length

I have a table named rabbits. I am trying to find the average row length in my table. I tried this query:

SELECT AVG_ROW_LENGTH(rabbits)

but it doesn't work.

like image 401
user5680735 Avatar asked Dec 06 '22 19:12

user5680735


2 Answers

My Googling has indicated that AVG_ROW_LENGTH is actually a column in information_schema.tables. You'll want to try something like this, I think:

SELECT AVG_ROW_LENGTH FROM information_schema.tables WHERE TABLE_NAME = 'rabbits';

You may also need to specify the database name by adding "AND TABLE_SCHEMA = 'databasename';" if you have more than one database with a rabbits table.

Hope this helps!

like image 90
Redbeard011010 Avatar answered Dec 24 '22 14:12

Redbeard011010


You can't SELECT that, try this instead:

SELECT Avg_row_length FROM information_schema.tables WHERE table_name='rabbits';
like image 26
miken32 Avatar answered Dec 24 '22 16:12

miken32