Goal Find the number of rows in base tables.
Type General (Overview of some aspect of the database.)
License MIT (opens in new tab)
Data Source system catalog only
SQL Query
ANALYZE;
SELECT n.nspname AS schema_name, c.relname AS table_name, c.reltuples
FROM pg_catalog.pg_class c
INNER JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
INNER JOIN pg_catalog.pg_authid u ON u.oid = c.relowner
WHERE c.relkind IN ('r') 
AND (n.nspname = 'public' OR u.rolname <> 'postgres') 
ORDER BY reltuples DESC, n.nspname, c.relname;

Collections

This query belongs to the following collections:

Find problems by overview

Queries that results point to different aspects of database that might have problems. A human reviewer has to decide based on the results as to whether there are problems or not .

NameDescription
Find problems by overviewQueries that results point to different aspects of database that might have problems. A human reviewer has to decide based on the results as to whether there are problems or not .

Categories

This query is classified under the following categories:

Data at the database logical level

Queries of this category provide information about data in base tables.

NameDescription
Data at the database logical levelQueries of this category provide information about data in base tables.