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 the disk space is not available to host databases. Take this into account when selecting a configuration lineup.
You can track disk usage using disk occupancy notifications and metrics. Learn more about metrics in the Monitoring PostgreSQL clusters and nodes for 1C guide.
When the cluster disk is 95% full or more, the cluster will enter the DISK_FULL status and will operate in read-only mode. This is necessary to prevent complete locking or corruption of the cluster due to a lack of free space. To make the cluster work in read-write mode, clean up the disk or resize the cluster and select a configuration with a larger disk size than in the previous configuration.
Disk occupancy notifications
Disk occupancy notifications are sent to the email address of the account owner and users who are 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 up the disk. This query can create large selections on large tables and store them on the disk. The remaining free space on the disk may run out completely, which will lead to issues with PostgreSQL and the need to restore its operation manually.
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.