Greetings
Is there a query to find all the columns and size of each one in a table in mysql
Thank you
Greetings
Is there a query to find all the columns and size of each one in a table in mysql
Thank you
Hi @Dba1
If you are looking to gather information about your schema such as max char limits and column names + types, you can use INFORMATION_SCHEMA
.COLUMNS
, for example:
SELECT
table_schema,
table_name,
column_name,
data_type,
character_maximum_length
FROM
information_schema.columns
WHERE
table_schema NOT IN ('information_schema' , 'performance_schema', 'sys');
Thanks you for your reply
basically I’m looking to find out the size of a particular field(column_name). I have a column with a “BLOB” data type, I’m trying to find out if the size of this column is causing the sudden increase we are seeing in the table.
Thank you
Note
Hi @Dba1 sorry about the tardy reply, I didn’t see this in my inbox until now
You can use something like the LENGTH()
function:
SELECT LENGTH(`MY_BLOB_COLUMN`) FROM my_table ORDER BY LENGTH(`MY_BLOB_COLUMN`) DESC;
Unanswered | Unsolved | Solved
MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright © 2006 - 2024 Percona LLC. All rights reserved.