Products | Versions |
---|---|
TIBCO Data Virtualization | All supported versions |
3. Once connected to the database, run below commands or queries to review the table contents. For complete list of commands, go to help section by running \?.
cisrepo=# \l Show all the databases in the repository
cisrepo=# SELECT nspname || '.' || relname AS "relation", Find top 20 tables with maximum table size
pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size"
FROM pg_class C
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE nspname NOT IN ('pg_catalog', 'information_schema')
AND C.relkind <> 'i'
AND nspname !~ '^pg_toast'
ORDER BY pg_total_relation_size(C.oid) DESC
LIMIT 20;
cisrepo=# \c <database_name> Connect to a different database
postgres=# show search_path; Show the environment variable search_path
postgres=# set search_path to cisrepo; Set search_path to database cisrepo
orders=# \dt[+] List all the tables in the current search path(sign '+' is optional)
orders=# select count(*) from [table_name]; Find the total numbers of rows for a particular table
orders=# \? Show help
orders=# \q Quit psql