{"id":13582254,"url":"https://github.com/timescale/timescaledb-tune","last_synced_at":"2025-05-14T05:05:08.276Z","repository":{"id":33704942,"uuid":"158437146","full_name":"timescale/timescaledb-tune","owner":"timescale","description":"A tool for tuning TimescaleDB for better performance by adjusting settings to match your system's CPU and memory resources.","archived":false,"fork":false,"pushed_at":"2025-05-02T00:06:04.000Z","size":278,"stargazers_count":468,"open_issues_count":20,"forks_count":45,"subscribers_count":26,"default_branch":"main","last_synced_at":"2025-05-07T04:58:49.210Z","etag":null,"topics":["postgresql","timescaledb","tuning"],"latest_commit_sha":null,"homepage":"https://www.timescale.com/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timescale.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-11-20T18:56:15.000Z","updated_at":"2025-05-01T19:29:20.000Z","dependencies_parsed_at":"2023-01-15T02:08:46.939Z","dependency_job_id":"658dc681-45bd-449d-89eb-0260b3e25876","html_url":"https://github.com/timescale/timescaledb-tune","commit_stats":null,"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timescale%2Ftimescaledb-tune","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timescale%2Ftimescaledb-tune/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timescale%2Ftimescaledb-tune/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timescale%2Ftimescaledb-tune/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timescale","download_url":"https://codeload.github.com/timescale/timescaledb-tune/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254076484,"owners_count":22010611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["postgresql","timescaledb","tuning"],"created_at":"2024-08-01T15:02:32.206Z","updated_at":"2025-05-14T05:05:08.231Z","avatar_url":"https://github.com/timescale.png","language":"Go","funding_links":[],"categories":["Go","Compiled list","Optimization"],"sub_categories":["plv8:"],"readme":"## timescaledb-tune\n\n`timescaledb-tune` is a program for tuning a\n[TimescaleDB](//github.com/timescale/timescaledb) database to perform\nits best based on the host's resources such as memory and number of CPUs.\nIt parses the existing `postgresql.conf` file to ensure that the TimescaleDB\nextension is appropriately installed and provides recommendations for\nmemory, parallelism, WAL, and other settings.\n\n### Getting started\nYou need the Go runtime (1.12+) installed, then simply `go install` this repo:\n```bash\n$ go install github.com/timescale/timescaledb-tune/cmd/timescaledb-tune@main\n```\n\nIt is also available as a binary package on a variety systems using\nHomebrew, `yum`, or `apt`. Search for `timescaledb-tools`.\n\n### Using timescaledb-tune\nBy default, `timescaledb-tune` attempts to locate your `postgresql.conf`\nfile for parsing by using heuristics based on the operating system, so the\nsimplest invocation would be:\n```bash\n$ timescaledb-tune\n```\n\nYou'll then be given a series of prompts that require minimal user input to\nmake sure your config file is up to date:\n```text\nUsing postgresql.conf at this path:\n/usr/local/var/postgres/postgresql.conf\n\nIs this correct? [(y)es/(n)o]: y\nWriting backup to:\n/var/folders/cr/zpgdkv194vz1g5smxl_5tggm0000gn/T/timescaledb_tune.backup201901071520\n\nshared_preload_libraries needs to be updated\nCurrent:\n#shared_preload_libraries = 'timescaledb'\nRecommended:\nshared_preload_libraries = 'timescaledb'\nIs this okay? [(y)es/(n)o]: y\nsuccess: shared_preload_libraries will be updated\n\nTune memory/parallelism/WAL and other settings? [(y)es/(n)o]: y\nRecommendations based on 8.00 GB of available memory and 4 CPUs for PostgreSQL 11\n\nMemory settings recommendations\nCurrent:\nshared_buffers = 128MB\n#effective_cache_size = 4GB\n#maintenance_work_mem = 64MB\n#work_mem = 4MB\nRecommended:\nshared_buffers = 2GB\neffective_cache_size = 6GB\nmaintenance_work_mem = 1GB\nwork_mem = 26214kB\nIs this okay? [(y)es/(s)kip/(q)uit]:\n```\n\nIf you have moved the configuration file to a different location, or\nauto-detection fails (file an issue please!), you can provide the location\nwith the `--conf-path` flag:\n```bash\n$ timescaledb-tune --conf-path=/path/to/postgresql.conf\n```\n\nAt the end, your `postgresql.conf` will be overwritten with the changes\nthat you accepted from the prompts.\n\n#### Other invocations\n\nBy default, timescaledb-tune provides recommendations for a typical timescaledb workload. The `--profile` flag can be\nused to tailor the recommendations for other workload types. Currently, the only non-default profile is \"promscale\".\nThe `TSTUNE_PROFILE` environment variable can also be used to affect this behavior.\n\n```bash\n$ timescaledb-tune --profile promscale\n```\n\nIf you want recommendations for a specific amount of memory and/or CPUs:\n```bash\n$ timescaledb-tune --memory=\"4GB\" --cpus=2\n```\n\nIf you want to set a specific number of background workers (`timescaledb.max_background_workers`):\n```bash\n$ timescaledb-tune --max-bg-workers=16\n```\n\nIf you have a dedicated disk for WAL, or want to specify how much of a\nshared disk should be used for WAL:\n```bash\n$ timescaledb-tune --wal-disk-size=\"10GB\"\n```\n\nIf you want to accept all recommendations, you can use `--yes`:\n```bash\n$ timescaledb-tune --yes\n```\n\nIf you just want to see the recommendations without writing:\n```bash\n$ timescaledb-tune --dry-run\n```\n\nIf there are too many prompts:\n```bash\n$ timescaledb-tune --quiet\n```\n\nAnd if you want to skip all prompts and get quiet output:\n```bash\n$ timescaledb-tune --quiet --yes\n```\n\nAnd if you want to append the recommendations to the end of your conf file\ninstead of in-place replacement:\n```bash\n$ timescaledb-tune --quiet --yes --dry-run \u003e\u003e /path/to/postgresql.conf\n```\n\n### Restoring backups\n\n`timescaledb-tune` makes a backup of your `postgresql.conf` file each time\nit runs (without the `--dry-run` flag) in your temp directory. If you find\nthat the configuration given is not working well, you can restore a backup\nby using the `--restore` flag:\n```bash\n$ timescaledb-tune --restore\n```\n```text\nUsing postgresql.conf at this path:\n/usr/local/var/postgres/postgresql.conf\n\nIs this correct? [(y)es/(n)o]: y\nAvailable backups (most recent first):\n1) timescaledb_tune.backup201901222056 (14 hours ago)\n2) timescaledb_tune.backup201901221640 (18 hours ago)\n3) timescaledb_tune.backup201901221050 (24 hours ago)\n4) timescaledb_tune.backup201901211817 (41 hours ago)\n\nUse which backup? Number or (q)uit: 1\nRestoring 'timescaledb_tune.backup201901222056'...\nsuccess: restored successfully\n```\n\n### Contributing\nWe welcome contributions to this utility, which like TimescaleDB is\nreleased under the Apache2 Open Source License.  The same [Contributors Agreement](//github.com/timescale/timescaledb/blob/master/CONTRIBUTING.md)\napplies; please sign the [Contributor License Agreement](https://cla-assistant.io/timescale/timescaledb-tune) (CLA) if you're a new contributor.\n\n### Releasing\n\nPlease follow the instructions [here](https://github.com/timescale/eng-database/wiki/Releasing-timescaledb-tune) \nto publish a release of this tool.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimescale%2Ftimescaledb-tune","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimescale%2Ftimescaledb-tune","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimescale%2Ftimescaledb-tune/lists"}