select table_schema,
table_name,
(xpath('/row/cnt/text()', xml_count))[1]::text::int as row_count
from (
select table_name, table_schema,
query_to_xml(format('select count(*) as cnt from %I.%I', table_schema, table_name), false, true, '') as xml_count
from information_schema.tables
where table_schema = 'test'
AND table_name IN ('abc') --<< change here for the schema you want
) t order by 3 DESC
---------------------------------------------
APPROACH 2 with WHERE CONDITION
---------------------------------------------
select table_schema,
table_name,
(xpath('/row/cnt/text()', xml_count))[1]::text::int as row_count
from (
select table_name, table_schema,
query_to_xml(format('select count(*) as cnt from %I.%I WHERE updated > ''2022-10-01 00:00:00''', table_schema, table_name), false, true, '') as xml_count
from information_schema.tables
where table_schema = 'test'
AND table_name NOT IN ('abc')
AND table_name NOT LIKE ('ad_%') --<< change here for the schema you want
) t order by 3 DESC