PostgreSQL — 15 Most Useful Commands with Examples
PostgreSQL is designed especially to work with large datasets, and thus Postgres is a perfect match for Data Science. In this article, we’ll go through some of my personally frequently used and useful Postgre commands.
There are many PostgreSQL tutorials on the net that describe the basic commands. But when you dive deeper into the work, practical questions arise that require advanced teams.
Such commands, or snippets, are rarely documented. Let’s look at a few examples, useful for both developers, data scientists, and database administrators.
📃Getting information about a PostgreSQL database📃
👉 Database size
To get the physical size of the database files (storage), we use the following query:
The result will be presented as a number of the kind 41809016
.
current_database()
- a function that returns the name of the current database. Instead, you can enter a name in the text: