PostgreSQL – Identify tables used by a View

You can query the system catalog view view_table_usage to identify all the tables used by a view in Postgres database. Below is the sql query to see the tables used by a view where ‘your_view’ is the name of your view.

SELECT table_schema, table_name from information_schema.view_table_usage where view_name='your_view';

See also  PostgreSQL - AVG (Average) Function