Database management
This page describes CloudBase PostgreSQL database instance specifications, metering, and specification changes. In the CloudBase console, select the PostgreSQL database for the target environment, then open the Configuration page. Available options are determined by the console.
Instance specification types
CloudBase PostgreSQL database provides the following instance specification types:
| Instance specification type | Characteristics | Suitable scenarios |
|---|---|---|
| Micro instance | CPU and memory resources are shared. Compute usage is billed by actual use. No compute usage is incurred when there is no database access, scheduled job, function, or transaction processing. Storage is billed by actual usage. | Development, testing, personal projects, and non-critical workloads with infrequent calls and clear idle periods. |
| Standard instance | Each specification has a defined number of CPU cores and amount of memory. Compute specifications can be adjusted as needed. | Workloads that need stable resources, continuous operation, or independent compute and storage capacity planning. |
Micro instances share CPU and memory resources. Standard instances can adjust compute specifications and storage capacity according to workload. Choose an instance specification based on how the workload runs, its resource-control requirements, and capacity plan.
Instance specifications
Instance compute specifications include micro and standard options. Micro instances share CPU and memory resources. Each standard specification has a defined number of CPU cores and amount of memory. The options are:
| Specification type | Compute specification |
|---|---|
| Micro | Micro, with shared CPU and memory |
| Standard | 1 core 2 GiB |
| Standard | 2 cores 4 GiB |
| Standard | 2 cores 6 GiB |
| Standard | 4 cores 8 GiB |
| Standard | 8 cores 16 GiB |
| Standard | 16 cores 32 GiB |
Higher standard specifications generally support more concurrent connections and queries and provide a larger data cache. Available specifications vary by region and database version; refer to the console.
Standard instance compute specifications can be scaled up or down as needed. Evaluate peak workloads before changing specifications, then monitor CPU, memory, and connection count after the change.
Use the following criteria when choosing a specification:
| Consideration | Recommendation |
|---|---|
| Sustained high CPU usage | Select a specification with more CPU, or first reduce SQL computation through query optimization. |
| Memory pressure or low cache hit rate | Select a specification with more memory and review large queries, sorting, connection count, and index design. |
| Connection count approaching the limit | Review connection pool configuration first. Select a higher specification only when demand continues to grow. See connection management. |
| Large peak-to-trough workload variation | Select a specification based on peak load and capacity planning. Avoid sizing permanently for transient peaks. |
Standard instances support compute specification changes and storage expansion. Micro instances run on demand and share CPU and memory resources.
Billing model
CloudBase PostgreSQL database uses different methods to measure compute and storage usage for each instance specification type. For pricing and usage conversion rules, see CloudBase billable capability items. The console is the source of truth.
Compute usage
Micro instances: usage-based billing
Compute usage for micro instances is measured by actual database use:
- The measurement unit is five minutes, with each micro instance measured as 0.5 CPU cores.
- A five-minute interval is recorded as used when it contains database access or in-database scheduled jobs, functions, or transaction processing.
- For a used interval, compute usage is
0.5 * 5 / 60 = 0.04167 CU. If the database is used throughout an hour, total usage is0.5 CU. - A five-minute interval with no connection, read or write, scheduled job, function, or transaction processing does not incur compute usage.
Standard instances: specification-based billing
Compute usage for standard instances is determined by the instance specification and actual running time, whether or not the instance is accessed. Compute usage continues while the instance runs. After a specification change takes effect, usage is measured using the new specification.
For example, a standard instance with 1 CPU core and 2 GiB of memory incurs 1 CU for each hour it runs; an instance with 2 CPU cores and 4 GiB of memory incurs 2 CU for each hour it runs.
Storage usage
Micro instances: actual usage billing
Micro instances are measured by the storage space actually occupied by database data. Default tables and data consume a small amount of storage after database creation, so storage usage can occur even before business data is written.
Standard instances: allocated capacity billing
Standard instances are measured by allocated storage capacity and running time, not the amount of data actually written. Usage is calculated from the allocated capacity regardless of how much space is used.
For example, a standard instance allocated 20 GB of storage incurs 20 GB-hours for one hour of operation and 480 GB-hours for 24 hours of continuous operation. Storage can be expanded but cannot be reduced.
Change specifications
Instances support compute specification changes. Standard instances also support storage expansion.
⚠️ After a micro instance is changed to a standard specification, it cannot be changed back to micro.
Change compute specifications
Select a target compute specification when workload changes or monitoring shows insufficient resources.
Pre-change checklist
- Use monitoring data to confirm that CPU, memory, or connection capacity is the bottleneck. Do not scale up solely because of a single slow query.
- Confirm that the instance is available and that no specification change is in progress.
- Confirm that the target specification is available for the current region, instance specification type, and database version, and review the pricing change.
- Schedule the change during off-peak hours. Production applications should support connection retry and connection-pool recovery.
Steps
- Sign in to the CloudBase console and select the PostgreSQL database for the target environment.
- Open the Configuration page, then select Change specification in the compute specification section.
- Select the target compute specification, review the configuration and pricing, and submit the change.
- Wait for the change to finish and confirm that the instance returns to the available state.
- Check application connections, reads and writes, scheduled jobs, and database monitoring metrics.
Changing specifications can briefly interrupt database connections. Clients and servers must handle connection, transaction, and retry failures correctly. Do not treat an uncommitted transaction as successfully completed.
Recommendations
- Before scaling up, investigate slow queries, missing indexes, long-running transactions, and abnormal connections. More resources should not replace necessary optimization.
- Before scaling down, confirm that peak workloads, scheduled jobs, and batch workloads are stable on the target specification.
- After every change, monitor CPU, memory, connection count, slow queries, and application error rate. Make further changes only after metrics stabilize.
- Keep change records for critical workloads, including the time, original and target specifications, monitoring data, and validation results.
Expand storage capacity
Micro instances do not require separate storage expansion and have a maximum storage capacity of 500 MB. If usage exceeds this limit, the database becomes read-only. Change the compute specification to a standard specification to remove the limit.
Expand storage capacity for a standard instance when storage usage continues to increase or data and index growth approaches the current capacity. Storage capacity can only be increased and cannot be decreased. Available capacities, billing, and limits are determined by the console.
Pre-expansion checklist
- Check current storage usage and its growth trend in logs and monitoring, then estimate growth from data and indexes.
- Confirm that the standard instance is available and that no specification change is in progress.
- Confirm that the target storage capacity is available for the current region and instance specification, and review the pricing change.
Steps
- Sign in to the CloudBase console and select the PostgreSQL database for the target environment.
- Open the Configuration page, then select Expand storage capacity in the storage section.
- Select the target storage capacity, review the configuration and pricing, and submit the change.
- Wait for the expansion to finish and confirm that the instance returns to the available state.
- Check storage usage, application reads and writes, and database monitoring metrics.
You do not need to change application connection information after expansion. Use the connection information displayed in the console as the source of truth and verify application connectivity.
FAQ
Does changing specifications change the connection endpoint
Usually, no. Use the connection information shown in the console as the source of truth, and verify application connectivity after the operation.
Can standard specifications be changed to micro specifications
After a micro instance is changed to standard specifications, it cannot be changed back to micro specifications.
Connection errors during specification changes
A specification change may involve a node switchover or restart, briefly invalidating existing connections. Use connection pools, retry policies, and idempotent design to prevent duplicate writes or inconsistent data.
Choosing a specification change
Change a micro instance to standard specifications when the workload needs stable resources or independent specification control. When a standard instance has insufficient resources, change compute specifications or expand storage capacity.