-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdbsee_tablewidth.sql
More file actions
27 lines (26 loc) · 1.02 KB
/
dbsee_tablewidth.sql
File metadata and controls
27 lines (26 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*********************************************************************/
/* Author : VLDB */
/* Date : 23/02/2017 */
/* Version : 1 */
/* Description : Generate report on number of columns per table */
/*********************************************************************/
select t1.databasename as database_name
,t1.tablename as table_name
,t2.total as total_perm
,count(t1.columnname) as number_columns
from dbc.columnsv t1
left join
(select databasename
,tablename
,sum(currentperm) as total
from dbc.tablesizev
group by 1,2) t2
on t1.databasename = t2.databasename
and t1.tablename = t2.tablename
inner join
dbc.tablesV t3
on t1.databasename = t3.databasename
and t1.tablename = t3.tablename
where t3.tablekind in ('O','T')
group by 1,2,3
;