Skip to content
HALOWERK

Codewerk

pg config tune

Implements the PGTune rules of thumb exactly as in PGTune (MIT, https://github.com/le0pard/pgtune, configurationSelectors.js at commit f740af00, 2026-10-30): shared_buffers RAM/4 (desktop RAM/16), effective_cache_size RAM*3/4, maintenance_work_mem RAM/16 (dw RAM/8, capped), wal_buffers like wal_buffers=-1, work_mem from (RAM - shared_buffers) / ((max_connections + parallel workers) * 3) with workload factors and a 4MB floor, random_page_cost and effective_io_concurrency by storage, parallel.

POST https://code.halowerk.com/v1/pg-config-tune

Inputs

Fields of the published input schema
FieldTypeRequiredDescription
total_memoryintegerYesTotal RAM of the database server in memory_unit.
memory_unitstringNo
cpusintegerNoCPU cores; parallel settings need at least 4.
connectionsintegerNoExpected max_connections; derived from the workload if omitted.
db_versionintegerNo
osstringNo
workloadstringNo
storagestringNo
data_sizestringNoDatabase size compared with RAM (mid_ram = 1x-3x RAM).
current_configstringNoOptional current postgresql.conf for a diff.
Show full input schema
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "total_memory"
  ],
  "properties": {
    "total_memory": {
      "type": "integer",
      "minimum": 1,
      "maximum": 999999,
      "description": "Total RAM of the database server in memory_unit."
    },
    "memory_unit": {
      "type": "string",
      "enum": [
        "MB",
        "GB",
        "TB"
      ],
      "default": "GB"
    },
    "cpus": {
      "type": "integer",
      "minimum": 1,
      "maximum": 999999,
      "description": "CPU cores; parallel settings need at least 4."
    },
    "connections": {
      "type": "integer",
      "minimum": 20,
      "maximum": 260000,
      "description": "Expected max_connections; derived from the workload if omitted."
    },
    "db_version": {
      "type": "integer",
      "minimum": 10,
      "maximum": 19,
      "default": 18
    },
    "os": {
      "type": "string",
      "enum": [
        "linux",
        "windows",
        "mac"
      ],
      "default": "linux"
    },
    "workload": {
      "type": "string",
      "enum": [
        "web",
        "oltp",
        "dw",
        "desktop",
        "mixed"
      ],
      "default": "web"
    },
    "storage": {
      "type": "string",
      "enum": [
        "ssd",
        "hdd",
        "san",
        "nvme"
      ],
      "default": "ssd"
    },
    "data_size": {
      "type": "string",
      "enum": [
        "less_ram",
        "mid_ram",
        "greater_ram"
      ],
      "default": "mid_ram",
      "description": "Database size compared with RAM (mid_ram = 1x-3x RAM)."
    },
    "current_config": {
      "type": "string",
      "maxLength": 500000,
      "description": "Optional current postgresql.conf for a diff."
    }
  }
}

Open original schema

Published input example

{
  "total_memory": 16,
  "cpus": 8,
  "db_version": 18,
  "workload": "web",
  "storage": "ssd"
}

Result & documentation

Machine-readable documentation of this hub

Source of this page: the published HALOWERK catalog. Updated: 2026-11-17 UTC.

More endpoints in this hub

All endpoints in this hub โ†’