When working with SQL, there are times when you would like to keep your statements re-usable. This is especially the case when working with large, or intricate queries. There are few things more frustrating then having to re-type in a long query over and over again within psql , and it can be highly inefficient to have to pass excessively large queries over a network to your PostgreSQL server for common routines.

This is where views can come in handy. Views can be thought of as stored queries, allowing you to create a database object which functions very similarly to a table, but whose contents are dynamically and directly reflective only of the rows which it is defined to select. Views are quite flexible in practice, in that they may address common, simple queries to a single table, as well as extraordinarily complicated ones which may span across several tables.