Using disk space in a PostgreSQL for 1C cluster
In Managed Databases, part of the disk space is reserved for service needs:
- for the file system — approximately 4% of the disk volume;
- for the operating system, service components, and logs — approximately 8 GB.
The reserved portion of disk space is unavailable for hosting databases. Take this into account when choosing a configuration lineup.
You can track disk capacity using disk capacity notifications and metrics. For more information about metrics, see the Monitoring PostgreSQL for 1C clusters and nodes guide.
When a cluster disk is 95% full or more, the cluster will enter the DISK_FULL status and will function in read-only mode. This is necessary to prevent complete cluster lockout or corruption due to lack of free space. To restore read and write operations, clean up the disk or scale the cluster and choose a configuration with a larger disk size than in the previous configuration.
Disk occupancy notifications
Disk capacity notifications are sent via email to the Account Owner and users subscribed to the notification category "Services". Notifications are sent when the disk is 80% and 95% full.
Clear the disk
We do not recommend using the DELETE FROM table WHERE ... query to clean the disk. This query can generate large result sets on large tables and write them to the disk. Remaining free disk space may be completely exhausted, which will lead to PostgreSQL issues and the need for manual restoration of its operation.
Open the transaction transaction_read_only = no and delete unnecessary data using one of the following queries:
-
DROP TABLE— completely deletes the table: data, structure, indexes, constraints (constraints), and triggers.BEGIN;SET transaction_read_only = no;DROP TABLE table_name;COMMIT; -
TRUNCATE TABLE— removes all rows from a table. It works faster thanDELETE.BEGIN;SET transaction_read_only = no;TRUNCATE TABLE table_name;COMMIT; -
DELETE— deletes rows specified in theWHEREcondition.