@NogDogMar 16.2021 — #I have to confess to a curiosity why you want/need to do this. But I was also curious how easy/difficult it would be to do in PostgreSQL, and found this bit of SQL on stackoverflow that seems to work fine for me. :) [code=sql] 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 = 'public' --<< change here for the schema you want ) t [/code]
@sibertMar 16.2021 — #This may work, but you have to find a way to only display "your" tables. This query shows ALL system tables as well. Some of them are empty...
``<i> </i>SELECT TABLE_NAME, SUM(TABLE_ROWS) FROM INFORMATION_SCHEMA.TABLES GROUP BY 1<i> </i>`` https://www.db-fiddle.com/f/eaQG8H4yqY9hnQBZjzJgz/14
@NogDogMar 17.2021 — #> @kiwis80#1629345 But there are some tables which are out by a few
Hmm... from [this post](https://dba.stackexchange.com/questions/151769/mysql-difference-between-using-count-and-information-schema-tables-for-coun) it sounds like you can improve the accuracy by running analyze table?
> c) using the information_schema tables, as the linked question: [code=sql]select table_rows from information_schema.tables where table_schema = 'database_name' and table_name = 'table_name' ;[/code] Accuracy: Only an approximation. If the table is the target of frequent inserts and deletes, the result can be way off the actual count. This can be improved by running ANALYZE TABLE more often.
Efficiency: Very good, it doesn't touch the table at all.
@NogDogMar 18.2021 — #It appears that what's in the INFORMATION_SCHEMA is not constantly updated. If you need an exact, at the moment count, I'd probably create a script that uses it to get a list of tables, and then run a query on each to get the count.
@tyagianubhav9Apr 28.2021 — #I'd probably create a script that uses it to get a list of tables, and then run a query on each to get the count. [teatv app](https://teatv.ltd)[sbi hrms](https://hellodear.in/sbi-hrms-onlinesbi/)