Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
ddhodge committed Apr 27, 2024
1 parent 2222ea3 commit c9e2922
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions docs/content/preview/architecture/system-catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ In most cases, developers and applications interact with _information_schema_ fo

_information_schema_ provides a standardized, SQL-compliant view of database metadata that is portable across different database systems and is defined in the [SQL standard](https://www.iso.org/standard/76586.html), while pg_catalog offers detailed, PostgreSQL-specific system catalogs for internal database operations and management.

Let us look at some of the important information that can be fetched using the system catalog tables and views followed by a summary of other members.
Let's look at some of the important information that can be fetched using the system catalog tables and views, followed by a summary of other members.

## Schema

Expand All @@ -51,10 +51,10 @@ The schema details of the various database objects are stored in multiple tables
- _pg_index_ : stores detailed metadata about indexes, including details such as the indexed columns, index types, and index properties like uniqueness and inclusion of nullable values.
- _pg_constraint_ : stores information about constraints on tables. These can include unique constraints, check constraints, primary key constraints, and foreign key constraints.

This information is typically fetched using convenient views like:
This information is typically fetched using convenient views, such as the following:

- _pg_views_ : provides details on views and their definitions
- _pg_tables_ : provides details on tables, their ownership and basic properties (eg, if the table has any indexes etc)
- _pg_views_ : provides details on views and their definitions.
- _pg_tables_ : provides details on tables, their ownership, and basic properties (for example, if the table has any indexes).
- `information_schema.tables` : provides table information as per SQL standard.
- `information_schema.columns` : provides column information as per SQL standard.
- `information_schema.columns` : provides view information as per SQL standard.
Expand Down Expand Up @@ -92,14 +92,14 @@ The pg_locks view doesn't have a documented view definition that you can directl
{{</note>}}

{{<tip>}}
[pg_locks](#pg-locks) view can be joined to [pg_stat_activity](#pg-stat-activity) view on the _pid_ column to get more information on the session holding or awaiting each lock. To learn more about how the pg_locks can be used to get insights on transaction locks, see [Lock insights](../../explore/observability/pg-locks).
[pg_locks](#pg-locks) view can be joined to [pg_stat_activity](#pg-stat-activity) view on the _pid_ column to get more information on the session holding or awaiting each lock. To learn more about how pg_locks can be used to get insights on transaction locks, see [Lock insights](../../explore/observability/pg-locks).
{{</tip>}}

## Stored procedures

The _pg_proc_ catalog stores metadata about database procedures, including their names, argument types, return types, source code, and associated permissions. It enables developers and administrators can inspect function definitions, review function dependencies, and monitor usage statistics to optimize query performance and database operations.
The _pg_proc_ catalog stores metadata about database procedures, including their names, argument types, return types, source code, and associated permissions. It enables developers and administrators to inspect function definitions, review function dependencies, and monitor usage statistics to optimize query performance and database operations.

- _pg_stat_user_functions_ : provides stats on execution details on stored procedures (e.g. no.of calls, execution time spent)
- _pg_stat_user_functions_ : provides statistics on execution details on stored procedures (for example, number of calls, execution time spent).
- `information_schema.routines` view provides great detail about stored procedures from multiple tables.

## Query performance
Expand All @@ -111,19 +111,19 @@ By default, only _min_, _max_, _mean_, and _stddev_ of the execution times are a
{{</note>}}

{{<tip>}}
To understand how to improve query performance using these stats, see [Query tuning](../../explore/query-1-performance/pg-stat-statements/)
To understand how to improve query performance using these stats, see [Query tuning](../../explore/query-1-performance/pg-stat-statements/).
{{</tip>}}

## Data statistics

The statistics about the table data are stored in the _pg_statistics_ table. For efficiency, this data is not updated on the fly so it may not be up to date. This data can be updated by running the `ANALYZE` command. This table stores column-level information about the number of distinct values, most common values, their frequencies etc. This data is very useful for query tuning. The _pg_stats_ view provides user-friendly information by joining other tables with the _pg_statistic_ table.
The statistics about the table data are stored in the _pg_statistics_ table. For efficiency, this data is not updated on the fly so it may not be up to date. This data can be updated by running the `ANALYZE` command. This table stores column-level information about the number of distinct values, most common values, their frequencies, and so on. This data is very useful for query tuning. The _pg_stats_ view provides user-friendly information by joining other tables with the _pg_statistic_ table.

## Users and roles

The `pg_authid` table stores details of users, roles, groups and the corresponding privileges like if the user is a superuser, if the user can create a database etc. The membership of users to groups and roles is stored in the `pg_auth_members` table. This information is usually queried using the following views.
The `pg_authid` table stores details of users, roles, groups, and the corresponding privileges, such as whether the user is a superuser, the user can create a database, and so on. The membership of users to groups and roles is stored in the `pg_auth_members` table. This information is usually queried using the following views:

- _pg_roles_: stores metadata about database roles, including role names, privileges, membership, and login capabilities
- _pg_user_: Information specific to database users - user name, password and privileges
- _pg_roles_: stores metadata about database roles, including role names, privileges, membership, and login capabilities.
- _pg_user_: Information specific to database users, including user name, password, and privileges.

## Other tables

Expand Down

0 comments on commit c9e2922

Please sign in to comment.