Skip to content

Instantly share code, notes, and snippets.

@manuelvanrijn
Created July 30, 2012 08:12
Show Gist options
  • Select an option

  • Save manuelvanrijn/3205631 to your computer and use it in GitHub Desktop.

Select an option

Save manuelvanrijn/3205631 to your computer and use it in GitHub Desktop.

Revisions

  1. Manuel van Rijn created this gist Jul 30, 2012.
    9 changes: 9 additions & 0 deletions total_rows.sql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    SELECT
    SUM(pgClass.reltuples) AS totalRowCount
    FROM
    pg_class pgClass
    LEFT JOIN
    pg_namespace pgNamespace ON (pgNamespace.oid = pgClass.relnamespace)
    WHERE
    pgNamespace.nspname NOT IN ('pg_catalog', 'information_schema') AND
    pgClass.relkind='r'