Find number of columns in Vertica database

Query returns basic statistics of numbers of columns in a database.


select count(distinct table_id) as tables,
       count(*) as columns,
       round(count(*)/count(distinct table_id),2) as avg_column_count
from v_catalog.columns;


  • tables - number of tables in a database
  • columns - total number of columns in a database
  • avg_column_count - average number of columns in a table in a database


  • Query returns just one row

Sample results

Result from VMart sample database

There are no comments. Click here to write the first comment.