The query does not count the number of actual rows but relies on the result of statistics collection process (see the ANALYZE statement). The side effect of running the test is that the statistics of the entire database will be refreshed.
Type
General (Overview of some aspect of the database.)
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')
AND reltuples>=1000
ORDER BY reltuples DESC, n.nspname, c.relname;
Categories
This query is classified under the following categories:
Name
Description
Assessment
Queries of this category could be used specifically in the learning environment to assess as to whether student projects have filled certain criteria.
Data at the database logical level
Queries of this category provide information about data in base tables.