Query below returns distribution of column name lengths (number of characters).
Query
select length(column_name) as col_name_length,
count(*) as columns,
count(distinct table_id) as tables
from v_catalog.columns
group by length(column_name)
order by col_name_length desc;
Columns
- 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
Rows
- 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 results
Sample column name length distribution in VMart sample database.