Number of rows used in a database

Number of rows used in a database

Hi,

Is there any easy way to write a SQL or call an API to find out how many rows are used in a database i.e. sum the rows counts of each table (not view) in a database.

I tried the SQL path as shown below. When click the Execute button it works. However, if I try to save the SQL as a view and error pops up - " Parsing of Query failed, please check the syntax ".

SELECT SUM(rc.row_count) row_count FROM 
(SELECT count(*) as row_count FROM "event_log"
UNION
SELECT count(*) as row_count FROM "job_log") rc

Thanks
Sunil