1. Unit Specification for work_mem When setting the work_mem flag via gcloud command, what unit is used for the numeric value?
Example:
gcloud alloydb instances update INSTANCE_NAME \
--cluster=CLUSTER_NAME \
--region=REGION \
--database-flags=work_mem=16
Does work_mem=16 mean 16KB or 16MB?
2. Minimum Value Error I attempted to set work_mem=16 but received this error:
ERROR: (gcloud.alloydb.instances.update) INVALID_ARGUMENT: The request was invalid: value 16 for flag "work_mem" is invalid, minimum allowed value is 64
My goal was to set work_mem to 16MB, but I’m getting a minimum value error. This suggests either:
- The unit is KB and 16KB is below the minimum, or
- The unit is MB and 16MB is below the minimum of 64MB
3. Documentation Inconsistency There appears to be a discrepancy between different documentation sources:
PostgreSQL Official Documentation: States that work_mem units are in kilobytes when no unit is specified
- “If this value is specified without units, it is taken as kilobytes. It defaults to 4 megabytes (4MB).”
- Source: https://www.postgresql.org/docs/16/runtime-config-resource.html#GUC-WORK-MEM
AlloyDB Quotas Documentation: States the default is “4MB or the number of vCPUs, whichever is higher” and describes the format as “N MB”
- This “N MB” format suggests that the unit might be MB rather than KB
- Source: https://cloud.google.com/alloydb/quotas
Questions:
- What is the actual unit used for work_mem in AlloyDB database flags (KB or MB)?
- If I want to set work_mem to exactly 16MB, what value should I specify?
- Why is the minimum configurable value 64 when the documented default is 4MB or vCPU count?
- Is there a way to set work_mem to a value between the default (8MB for my 8-vCPU instance) and the minimum configurable value (64)?
Environment:
- AlloyDB instance type: READ_POOL
- Machine type: n2-highmem-8 (8 vCPU, 64GB RAM)
- Region: asia-northeast1
Expected Outcome: Clear documentation or confirmation of:
- The unit specification for work_mem database flag
- How to set work_mem to 16MB specifically
- The rationale behind the minimum configurable value
Thank you for your assistance in clarifying these points.