2.1 The Catalog Is a Table Too

What is recorded in the catalog? It holds which tables exist, which columns each table has and their types, which indexes and constraints are defined, and which users hold which privileges. The statistics that the optimizer, covered in Chapter 9, consults are also kept here. Put simply, it is "everything the database knows about itself."

There is an interesting fact here. The catalog does not live in a separate configuration file or a special storage area. The catalog is a table too. It is placed in pages in the same way as the customer table we created, passes through the buffer pool in the same way, and can be queried with SQL in the same way. The metadata that describes the data is itself stored and managed the same way as ordinary data.

This design has many advantages. There is no need to build a separate storage mechanism for the catalog, and the pages and buffer pool from the previous chapter apply as they are. Safeguards such as the WAL, covered in Chapter 5, protect the catalog in the same way without special handling.