Is it possible to login into the postgres database inside the docker image?

Amplifying on this, some basic postgres commands once you have the postgres command line in the container:

list all databases
\l

select a database
\c dbname

list tables in the current database
\dt

list columns in the users table
\d+ users

number of rows in the users table
select count(*) from users;

display value of configuration variables
show shared_buffers;

exit from the postgres console
\q

If you know SQL I am sure you can take it from here :wink: note that all SQL must terminate with semicolon ;

Also, some queries to identify largest tables.

14 Likes