Query below returns distribution of column name lengths (number of characters).
select length(column_name) as col_name_length,
count(*) as columns,
count(distinct table_id) as tables
group by length(column_name)
order by col_name_length desc;
- col_name_length - lenght in characters of column name
- columns - number of columns with this length
- tables - number of tables that have columns with this name length
- One row represents one name lenght (number of characters)
- Scope of rows: each column length that exists in a database
- Ordered by length ascending (from 1 to max)
Sample column name length distribution in VMart sample database.