Skip to content

Instantly share code, notes, and snippets.

@paulomcnally
Created August 16, 2018 21:07
Show Gist options
  • Select an option

  • Save paulomcnally/4bfc2f10b272083faea767d046a69f0b to your computer and use it in GitHub Desktop.

Select an option

Save paulomcnally/4bfc2f10b272083faea767d046a69f0b to your computer and use it in GitHub Desktop.
Contador de tablas por esquema en PostgreSQL
SELECT
count(*) AS "tables", schemaname
FROM
pg_tables
WHERE
schemaname
IN
(
SELECT
nspname
FROM
pg_catalog.pg_namespace
WHERE
nspname
NOT IN(
'pg_toast',
'pg_temp_1',
'pg_toast_temp_1',
'pg_catalog',
'information_schema',
'shared_extensions'
)
)
GROUP BY
schemaname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment