Skip to content

Instantly share code, notes, and snippets.

@rdeavila
Created February 28, 2014 13:42

Revisions

  1. Rodrigo Avila created this gist Feb 28, 2014.
    11 changes: 11 additions & 0 deletions pgsql-all-by-count.sql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    -- Usa as estatísticas do PostgreSQL para a contagem.
    -- Para números mais precisos, execute
    -- VACUUM ANALYZE
    -- antes de iniciar.
    SELECT
    relname,
    n_live_tup
    FROM
    pg_stat_user_tables
    ORDER BY
    n_live_tup DESC;