You can do this as a two step process.
- Dynamically building the SQL for getting the counts using the below query.
- Running the output of the SQL to generate the counts
with tname_vw(i) as ( SELECT concat( 'select ''', table_name, ''' as table_name, count(*) from ', table_name ) FROM information_schema.tables WHERE table_schema = 'schema_name' ) select array_join(array_agg(i), ' union ') as result from tname_vw
- Accepted Answerasked 2 months ago
- asked a month ago
- Accepted Answerasked 8 months ago
- Accepted Answerasked 18 days ago
- Accepted Answerasked 3 years ago