0
votes

imagine there are 5 schemas in my database and in every schema there is a common name table (ex:- table1) after every 5mins records get inserted in table1, how I can iterate in all schemas n calculate the count of table1[i have to automate the process so i am going to write the code in function and call that function after every 5mins using crontab].

SELECT (SELECT count(*) FROM schema1.table1) AS schema1count, (SELECT count(*) FROM schema2.table1) AS schema2count, (SELECT count(*) FROM schema3.table1) AS schema3count, …; - Bergi