How to determine database usage of an environment

Goal

Determine approximate database usage of a Platform.sh project using the Platform.sh CLI tool.

Assumptions

Problems

As a general rule, the database service should have at least 15% of disk space available on a Platform.sh project environment, so it is useful to be able to approximate the current disk usage of a project’s database(s).

Steps

1. Log in to Platform CLI

$ platform login

2. Find the project ID

Note the project ID of the project you’re checking:

$ platform project:list

3. Find the environment ID

Note the environment ID for the environment you’re checking.

$ platform environment:list -p <project-ID>

4. Run the database size command

$ platform db:size -p <project-ID> -e <environment-ID>

The command will return something like:

+----------------+-----------------+--------+
| Allocated disk | Estimated usage | % used |
+----------------+-----------------+--------+
| 14.6 GiB       | 9.4 GiB         | ~ 64%  |
+----------------+-----------------+--------+


Warning
This is an estimate of the databases disk usage. It does not represent its real size on disk.

Conclusion

Obtaining an approximate measure of your database usage can be done from the command line using the Platform.sh CLI tool.

1 Like