SQL queries in the management console
Managed Service for PostgreSQL lets you visualize the data structure in your PostgreSQL cluster and send SQL queries to databases from the Yandex.Cloud management console. To do this, log in to management console, open the cluster page and go to the SQL tab.
See a reference list of supported queries in the PostgreSQL documentation.
You can't use SQL commands to perform actions that require superuser privileges.
Access to the cluster from the management console
To connect to a Managed Service for PostgreSQL cluster from the management console and operate its data, activate the Access from management console option when creating a cluster or changing its settings.
Every time you open the SQL tab, you must enter the username and password of the cluster user and select the database to connect to. This opens the database structure and the SQL query input window.
To avoid entering the password too often, open this page of the management console in a new browser tab.
Data structure visualization
Once you have logged in, you can see the structure of the selected database and its tables:
Click on the table to see the first 1000 rows of the
SELECT * query result for this table, 20 rows per page (the management console doesn't support full navigation through all the DB data). In the Query result offset field, you can set the offset for showing the results table.
Hover over the column header to see the type of column data:
The query input window is open on the right. Start typing your query to see suggested keyword options:
Enter your query and click Execute. The results table or error message is shown in the results panel that is under the editor control buttons.
Query restrictions in the management console
- If you close or reload the page, the query text and its results are lost. In this case, each request that you run from the management console is executed regardless of the browser state.
- The management console outputs only the first 1000 rows of the result.
- If a cluster query takes more than 10 minutes, the management console reports an error instead of printing the result, even if the query eventually finishes processing.
- If your cluster has multiple PostgreSQL hosts, queries from the management console are sent to the current master host.
- The list of tables is taken from the public schema. You can make queries to tables from other schemas by explicitly specifying the schema, for example:
SELECT * from information_schema.column_udt_usage.