Skip to content

Instantly share code, notes, and snippets.

@dcube9
Created January 16, 2026 09:53
Show Gist options
  • Select an option

  • Save dcube9/4a652c2b5d7ad2a4a257c6b9de596daf to your computer and use it in GitHub Desktop.

Select an option

Save dcube9/4a652c2b5d7ad2a4a257c6b9de596daf to your computer and use it in GitHub Desktop.
POSTGRESQL - Conta i record di tutte le tabelle di un database
-- 1) Aggiorna le statistiche di tutte le tabelle del database corrente
ANALYZE;
-- 2) Leggi le stime aggiornate per tutte le tabelle utente
SELECT
schemaname AS schema_name,
relname AS table_name,
n_live_tup AS row_count_estimated
FROM pg_stat_user_tables
ORDER BY schemaname, relname;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment