AlloyDB work_mem Database Flag - Unit Specification and Minimum Value Clarification

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

AlloyDB Quotas Documentation: States the default is “4MB or the number of vCPUs, whichever is higher” and describes the format as “N MB”

Questions:

  1. What is the actual unit used for work_mem in AlloyDB database flags (KB or MB)?
  2. If I want to set work_mem to exactly 16MB, what value should I specify?
  3. Why is the minimum configurable value 64 when the documented default is 4MB or vCPU count?
  4. 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.

The minimum allowed value for work_mem is 64MB for AlloyDB. So, you won’t be able to set work_mem to 16MB.

While the default value (for example, 8MB) is automatically applied based on vCPUs, any manual overrides need to be 64MB or higher. This helps ensure consistent performance.

Unfortunately, it’s not possible to set a custom value between the default (e.g., 8MB) and the minimum configurable value (64MB).