How to list sequences in PostgreSQL

Feb 13, 2022 · 1 min read · Post a comment

Sequences in PostgreSQL are types of objects in a database that generates sequence of integers with specific requirements. Here are few ways to list them though.


  • PostgreSQL


Step 1. Login to PostgreSQL first. For instance:

psql -h some_host -d some_db -U some_username

List sequences using SQL query

Step 2.

SELECT * FROM information_schema.sequences;

or even better:

SELECT sequence_schema, sequence_name, data_type, minimum_value, maximum_value
FROM information_schema.sequences 
ORDER BY sequence_name;

List sequences using PSQL

Step 2.



Other potentially useful PostgreSQL listing queries:

On a side note, follow our official channel on Telegram.