[prev] 19 [next]

Exercise 1: Table Statistics

Using the PostgreSQL catalog, write a view
  • create view pop("table",ntuples) as ...
  • to return name of table and estimated #tuples
  • for all tables in the public schema

It should behave as follows:

db=# select * from pop;
  table   | ntuples 
----------+---------
 table1   |     162
 table2   |    2788
 table3   |    1500
...