Database Land

January 22, 2008

The Basics (IV) - Database Catalog

Filed under: basics, catalog, statistics — Amr El-Helw @ 10:45 am

The database catalog of a database is a repository of information (or meta data) about the various objects in the database, such as tables, views, indexes, users, etc. The information in the catalog is used by the database system when processing any of these objects.

For example, the information about a database table would include the definition of the table (i.e. the names of the columns, the data types, the primary key, and any foreign keys in that table), as well as statistics on the data stored in that table. These statistics include the number of tuples in that table, the number of physical data pages that the table occupies on disk, the user who owns the table. It also includes statistics about each column in that table, for example: the highest and lowest values in the column, the number of distinct values in the column, and possibly the distribution of data values in the column (usually in the form of a histogram). In addition to statistics about single columns, sometimes statistics are also maintained about groups of columns. For example, similar to keeping the number of distinct values, the catalog might contain the number of distinct value combinations in a group of columns. This can be useful in query processing.

Note that the database catalog is itself a set of tables. The information in the catalog can usually be accessed in the same way as the information in any other table, but usually only for viewing, not for update. Updating the catalog manually can cause serious inconsistencies in the database which can cause the database system to be unusable. For example, imagine if a user can manually update the catalog and change the definition of a table. In this case, the table definition would not match the data already stored in it, thus the data will be lost. For this reason, manual updates of the catalog are not permitted, and must only be done through specific commands.

Blog at WordPress.com.