How to Explore psql Informational Meta Commands for PostgreSQL Administration

If you work with PostgreSQL, one of the most powerful tools you can learn is the psql terminal. Inside psql, meta commands begin with a backslash (\) and help you inspect databases, schemas, tables, indexes, roles, functions, extensions, and many internal objects without writing long SQL queries.

This guide explains the informational meta commands in the same order shown by \d, including purpose, usage, and sample outputs.

Understanding Meta Commands

Meta commands are commands handled by the psql client, not by the PostgreSQL SQL engine.

Example:

\dt

This lists tables instantly.

1. \d - List Relations

Purpose

Shows tables, views, sequences, and relations in the current database.

Usage

\d

Example Output

                 List of relations
 Schema |        Name         |   Type   |  Owner   
--------+---------------------+----------+----------
 public | bg_test             | table    | postgres
 public | bg_test_id_seq      | sequence | postgres
 public | customers           | table    | postgres
 public | customers_id_seq    | sequence | postgres
 public | data                | table    | postgres
 public | demo                | table    | postgres

When to Use

Use this when you first connect and want to know what objects exist.

You can use \di to see the meta data of the index and use \ds to see the sequence related metadata also.

2. \da - List Aggregate Functions

Purpose

Shows aggregate functions such as sum, avg, count, or custom aggregates.

Usage

\da

Example Output

                                List of aggregate functions
 Schema |  Name      | Result data type | Argument data types | Description 
--------+------+------------------+---------------------+-------------
public | total_sales| numeric           | numeric             |
public | avg_score  | numeric           | integer             |

When to Use

Useful when exploring analytics functions.

3. \dA - List Access Methods

Purpose

Shows table and index access methods.

Usage

\dA

Example Output

List of access methods
   Name   | Type  
----------+-------
 brin     | Index
 btree    | Index
 columnar | Table
 gin      | Index
 gist     | Index
 hash     | Index
 heap     | Table
 spgist   | Index
(8 rows)

When to Use

Useful when studying storage engines and indexing internals.

4. \dAc - List Operator Classes

Purpose

Shows operator classes used by indexes.

Usage

\dAc

Example Output

                               List of operator classes
   AM   |         Input type          | Storage type |        Operator class        | Default? 
--------+-----------------------------+--------------+------------------------------+----------
 brin   | anyrange                    |              | range_inclusion_ops          | yes
 brin   | bigint                      |              | int8_bloom_ops               | no
 brin   | bigint                      |              | int8_minmax_multi_ops        | no
 brin   | bigint                      |              | int8_minmax_ops              | yes
 brin   | bit                         |              | bit_minmax_ops               | yes
 brin   | bit varying                 |              | varbit_minmax_ops            | yes

When to Use

Helpful for custom indexing and query optimization.In PostgreSQL, an operator class defines the set of rules an index uses to work with a specific data type. It tells the index:

  • Which operators can use the index (=, <, >, LIKE, etc.)
  • Which comparison functions should be used
  • How values are sorted or matched
  • How the index behaves for that data type

5. \dAf - List Operator Families

Purpose

Shows related operator classes grouped into families.

Usage

\dAf

Example Output

                                    List of operator families
   AM   |      Operator family      |                      Applicable types                       
--------+---------------------------+-------------------------------------------------------------
 brin   | bit_minmax_ops            | bit
 brin   | box_inclusion_ops         | box
 brin   | bpchar_bloom_ops          | character
 brin   | bpchar_minmax_ops         | character
 brin   | bytea_bloom_ops           | bytea
 brin   | bytea_minmax_ops          | bytea
 brin   | char_bloom_ops            | "char"
 brin   | char_minmax_ops           | "char"

When to Use

Advanced indexing research.

6. \dAo - List Operators of Operator Families

In PostgreSQL, List Operators of Operator Families means showing the operators that belong to an operator family used by indexes.

Purpose

Shows operators used inside operator families.

Usage

\dAo

Example Output

                                   List of operators of operator families
   AM   |      Operator family      |                          Operator                           | Strategy | Purpose  
--------+---------------------------+-------------------------------------------------------------+----------+----------
 brin   | bit_minmax_ops            | <(bit,bit)                                                  |        1 | search
 brin   | bit_minmax_ops            | <=(bit,bit)                                                 |        2 | search
 brin   | bit_minmax_ops            | =(bit,bit)                                                  |        3 | search
 brin   | bit_minmax_ops            | >=(bit,bit)                                                 |        4 | search
 brin   | bit_minmax_ops            | >(bit,bit)                                                  |        5 | search

When to Use

Useful for internal operator behavior.

7. \dAp - List Support Functions of Operator Families

Purpose

Shows support functions used by index methods.

Usage

\dAp

Example Output

                                                 List of support functions of operator families
   AM   |      Operator family      |    Registered left type     |    Registered right type    | Number |               Function               
--------+---------------------------+-----------------------------+-----------------------------+--------+--------------------------------------
 brin   | bit_minmax_ops            | bit                         | bit                         |      1 | brin_minmax_opcinfo
 brin   | bit_minmax_ops            | bit                         | bit                         |      2 | brin_minmax_add_value
 brin   | bit_minmax_ops            | bit                         | bit                         |      3 | brin_minmax_consistent
 brin   | bit_minmax_ops            | bit                         | bit                         |      4 | brin_minmax_union
 brin   | box_inclusion_ops         | box                         | box                         |      1 | brin_inclusion_opcinfo
 brin   | box_inclusion_ops         | box                         | box                         |      2 | brin_inclusion_add_value

When to Use

Important for source-code explorers and extension developers.

8. \db - List Tablespaces

Purpose

Shows tablespaces where database files are stored.

Usage

\db

Example Output

       List of tablespaces
    Name    |  Owner   | Location 
------------+----------+----------
 pg_default | postgres | 
 pg_global  | postgres | 
(2 rows)

When to Use

Useful for storage management.

9. \dc - List Conversions

Purpose

Shows character set conversions.

Usage

\dc

Example Output

                     List of conversions
 Schema |       Name        | Source | Destination | Default? 
--------+-------------------+--------+-------------+----------
 public | my_utf8_to_latin1 | UTF8   | LATIN1      | no
(1 row)

When to Use

Useful in multilingual systems.A multilingual system is a software system that supports multiple languages for users, data, or interfaces.

10. \dconfig - Show Non-default Configuration Parameters

Purpose

Its purpose is to view PostgreSQL default configuration parameters and their values.

Usage

\dconfig

Example Output

             List of non-default configuration parameters
         Parameter          |                  Value                  
----------------------------+-----------------------------------------
 application_name           | psql
 client_encoding            | UTF8
 cluster_name               | 18/main
 config_file                | /etc/postgresql/18/main/postgresql.conf
 data_directory             | /var/lib/postgresql/18/main
 DateStyle                  | ISO, DMY
 debug_print_plan           | on
 default_text_search_config | pg_catalog.english
 default_toast_compression  | lz4
 effective_io_concurrency   | 128
 external_pid_file          | /var/run/postgresql/18-main.pid
 hba_file                   | /etc/postgresql/18/main/pg_hba.conf
 huge_pages                 | off
 ident_file                 | /etc/postgresql/18/main/pg_ident.conf
 jit                        | off
 lc_messages                | en_IN
 lc_monetary                | en_IN
 lc_numeric                 | en_IN
 lc_time                    | en_IN
 log_line_prefix            | %m [%p] %q%u@%d main_server
 log_timezone               | Asia/Kolkata
 max_prepared_transactions  | 5
 password_encryption        | md5
 search_path                | "\$user", public, extensions
 shared_preload_libraries   | pglogical
 ssl                        | on
 ssl_cert_file              | /etc/ssl/certs/ssl-cert-snakeoil.pem
 ssl_key_file               | /etc/ssl/private/ssl-cert-snakeoil.key
 TimeZone                   | Asia/Kolkata
 wal_compression            | zstd
 wal_level                  | logical
 wal_log_hints              | on
 work_mem                   | 8MB
(33 rows)

When to Use

Great for tuning and debugging.

11. \dd - Object Descriptions

Purpose

Shows comments added to objects.

Usage

\dd

Example Output

                  Object descriptions
 Schema |    Name     | Object  |       Description       
--------+-------------+---------+-------------------------
 public | emp_trigger | trigger | Audits employee inserts
(1 row)

When to Use

Helpful for documented databases.

12. \ddp - Default Privileges

Purpose

Shows default permissions for new objects.

Usage

\ddp

Example Output

                                   Default access privileges
        Owner        |     Schema     |   Type   |              Access privileges              
---------------------+----------------+----------+---------------------------------------------
 postgres            | pgmq           | sequence | pg_monitor=r/postgres
 postgres            | pgmq           | table    | pg_monitor=r/postgres
 postgres            | public         | function | postgres=X/postgres                        +
                     |                |          | anon=X/postgres                            +
                     |                |          | authenticated=X/postgres                   +
                     |                |          | service_role=X/postgres
 postgres            | public         | sequence | postgres=rwU/postgres                      +
                     |                |          | anon=rwU/postgres                          +
                     |                |          | authenticated=rwU/postgres                 +

When to Use

Useful for permission planning.

13. \dE - List Foreign Tables

Purpose

Shows foreign tables from FDW connections.

Usage

\dE

Example Output

              List of foreign tables
 Schema |     Name      |     Type      |  Owner   
--------+---------------+---------------+----------
 public | remote_orders | foreign table | postgres
(1 row)

When to Use

Useful when integrating external data sources.

14. \des - List Foreign Servers

Purpose

Shows configured foreign servers.

Usage

\des

Example Output

      List of foreign servers
   Name    |  Owner   | Foreign-data wrapper 
-----------+----------+----------------------
 my_server | postgres | postgres_fdw
(1 row)

15. \det - List Foreign Tables

Purpose

Alternative listing of foreign tables.

Usage

\det

Example :

       List of foreign tables
 Schema |     Table     |  Server   
--------+---------------+-----------
 public | remote_orders | my_server
(1 row)

16. \deu - List User Mappings

Purpose

Shows login mappings for foreign servers.

Usage

\deu

Example Output

 List of user mappings
  Server   | User name 
-----------+-----------
 my_server | postgres
(1 row)

17. \dew - List Foreign Data Wrappers

Purpose

Shows installed FDW wrappers.

Usage

\dew

Example Output

                      List of foreign-data wrappers     Name     |  Owner   |       Handler        |       Validator        --------------+----------+----------------------+------------------------ postgres_fdw | postgres | postgres_fdw_handler | postgres_fdw_validator(1 row)

18. \df - List Functions

Purpose

Shows functions and procedures.

Usage

\df

Example Output

 Schema |             Name              | Result data type |                                                               Argument data types                                                                | Type 
--------+-------------------------------+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+------
 public | btean13cmp                    | integer          | ean13, ean13                                                                                                                                     | func
 public | btean13cmp                    | integer          | ean13, isbn                                                                                                                                      | func
 public | btean13cmp                    | integer          | ean13, isbn13                                                                                                                                    | func
 public | btean13cmp                    | integer          | ean13, ismn                                                                                                                                      | func
 public | btean13cmp                    | integer          | ean13, ismn13                                                                                                                                    | func

When to Use

Useful for backend logic inspection.

19. \dF - Text Search Configurations

Purpose

Shows full-text search configurations.

Usage

\dF

Example Output

               List of text search configurations
   Schema   |    Name    |              Description              
------------+------------+---------------------------------------
 pg_catalog | arabic     | configuration for arabic language
 pg_catalog | armenian   | configuration for armenian language
 pg_catalog | basque     | configuration for basque language
 pg_catalog | catalan    | configuration for catalan language
 pg_catalog | danish     | configuration for danish language
 pg_catalog | dutch      | configuration for dutch language
 pg_catalog | english    | configuration for english language
 pg_catalog | estonian   | configuration for estonian language
 pg_catalog | finnish    | configuration for finnish language
 pg_catalog | french     | configuration for french language
 pg_catalog | german     | configuration for german language
 pg_catalog | greek      | configuration for greek language
 pg_catalog | hindi      | configuration for hindi language
 pg_catalog | hungarian  | configuration for hungarian language
 pg_catalog | indonesian | configuration for indonesian language
 pg_catalog | irish      | configuration for irish language
 pg_catalog | italian    | configuration for italian language
 pg_catalog | lithuanian | configuration for lithuanian language
 pg_catalog | nepali     | configuration for nepali language
 pg_catalog | norwegian  | configuration for norwegian language
 pg_catalog | portuguese | configuration for portuguese language
 pg_catalog | romanian   | configuration for romanian language
 pg_catalog | russian    | configuration for russian language
 pg_catalog | serbian    | configuration for serbian language
 pg_catalog | simple     | simple configuration
 pg_catalog | spanish    | configuration for spanish language
 pg_catalog | swedish    | configuration for swedish language
 pg_catalog | tamil      | configuration for tamil language
 pg_catalog | turkish    | configuration for turkish language
 pg_catalog | yiddish    | configuration for yiddish language
(30 rows)

20. \dFd - Text Search Dictionaries

Purpose

Shows dictionaries used in text search.

Usage

\dFd

Example :

                             List of text search dictionaries
   Schema   |      Name       |                        Description                        
------------+-----------------+-----------------------------------------------------------
 pg_catalog | arabic_stem     | snowball stemmer for arabic language
 pg_catalog | armenian_stem   | snowball stemmer for armenian language
 pg_catalog | basque_stem     | snowball stemmer for basque language
 pg_catalog | catalan_stem    | snowball stemmer for catalan language
 pg_catalog | danish_stem     | snowball stemmer for danish language
 pg_catalog | dutch_stem      | snowball stemmer for dutch language
 pg_catalog | english_stem    | snowball stemmer for english language
 pg_catalog | estonian_stem   | snowball stemmer for estonian language
 pg_catalog | finnish_stem    | snowball stemmer for finnish language
 pg_catalog | french_stem     | snowball stemmer for french language
 pg_catalog | german_stem     | snowball stemmer for german language
 pg_catalog | greek_stem      | snowball stemmer for greek language
 pg_catalog | hindi_stem      | snowball stemmer for hindi language
 pg_catalog | hungarian_stem  | snowball stemmer for hungarian language
 pg_catalog | indonesian_stem | snowball stemmer for indonesian language
 pg_catalog | irish_stem      | snowball stemmer for irish language
 pg_catalog | italian_stem    | snowball stemmer for italian language
 pg_catalog | lithuanian_stem | snowball stemmer for lithuanian language
 pg_catalog | nepali_stem     | snowball stemmer for nepali language
 pg_catalog | norwegian_stem  | snowball stemmer for norwegian language
 pg_catalog | portuguese_stem | snowball stemmer for portuguese language
 pg_catalog | romanian_stem   | snowball stemmer for romanian language
 pg_catalog | russian_stem    | snowball stemmer for russian language
 pg_catalog | serbian_stem    | snowball stemmer for serbian language
 pg_catalog | simple          | simple dictionary: just lower case and check for stopword
 pg_catalog | spanish_stem    | snowball stemmer for spanish language
 pg_catalog | swedish_stem    | snowball stemmer for swedish language
 pg_catalog | tamil_stem      | snowball stemmer for tamil language
 pg_catalog | turkish_stem    | snowball stemmer for turkish language
 pg_catalog | yiddish_stem    | snowball stemmer for yiddish language
(30 rows)

21. \dFp - Text Search Parsers

A text search parser in PostgreSQL is a component of the Full Text Search system that breaks input text into tokens and identifies what each token is.

Purpose

Shows parsers used in full-text search.

Usage

\dFp

Example

       List of text search parsers
   Schema   |  Name   |     Description     
------------+---------+---------------------
 pg_catalog | default | default word parser
(1 row)

22. \dFt - Text Search Templates

In PostgreSQL, text search templates are objects used in the Full Text Search system to define how dictionaries should process tokens.

Purpose

Shows search templates.

Usage

\dFt

Example

                        List of text search templates
   Schema   |   Name    |                        Description                        
------------+-----------+-----------------------------------------------------------
 pg_catalog | ispell    | ispell dictionary
 pg_catalog | simple    | simple dictionary: just lower case and check for stopword
 pg_catalog | snowball  | snowball stemmer
 pg_catalog | synonym   | synonym dictionary: replace word by its synonym
 pg_catalog | thesaurus | thesaurus dictionary: phrase by phrase substitution
(5 rows)

Learning these commands turns psql into a powerful database inspection toolkit. Instead of writing long SQL queries against system catalogs, you can inspect structures instantly.

For daily work, start with:

  • \d
  • \dt
  • \di
  • \dn
  • \du
  • \dx
  • \dconfig

For advanced PostgreSQL internals, explore:

  • \dAc
  • \dAf
  • \dAo
  • \dAp
  • \dX
  • \drds
  • \dRp

These informational meta commands offer a fast way to inspect PostgreSQL databases, schemas, permissions, indexes, replication details, and configuration directly from the terminal.

whatsapp_icon
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message