drop table zzz_table_schema_rows_n;
create table zzz_table_schema_rows_n as
WITH tbl AS
(SELECT table_schema,
TABLE_NAME
FROM information_schema.tables
WHERE
1=1
AND TABLE_NAME not like 'pg_%'
AND TABLE_TYPE='BASE TABLE'
AND table_schema in ('uyumsoft'))
SELECT table_schema,
TABLE_NAME,
(xpath('/row/c/text()', query_to_xml(format('select count(*) as c from %I.%I', table_schema, TABLE_NAME), FALSE, TRUE, '')))[1]::text::int AS rows_n
FROM tbl
ORDER BY rows_n DESC;
select * from zzz_table_schema_rows_n
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (1)
stackoverflow.com/questions/259667...