Skip to content

Instantly share code, notes, and snippets.

@mjbommar
Created June 14, 2013 12:35
Show Gist options
  • Save mjbommar/5781482 to your computer and use it in GitHub Desktop.
Save mjbommar/5781482 to your computer and use it in GitHub Desktop.
For an Oracle database, select the (possibly stale) table row counts from all_tab_statistics for all tables with a given field name and owner. This example is based on the Oracle Transportation Management (OTM) schema and shows all table row counts for tables with a domain_name field.
SELECT table_name, num_rows, last_analyzed
FROM all_tab_statistics
WHERE table_name IN (SELECT table_name
FROM all_tab_cols
WHERE column_name = 'DOMAIN_NAME'
AND owner IN ('GLOGOWNER'))
ORDER BY num_rows DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment