{"id":19458507,"url":"https://github.com/postgrespro/plantuner","last_synced_at":"2025-04-25T06:30:28.028Z","repository":{"id":54534005,"uuid":"134561078","full_name":"postgrespro/plantuner","owner":"postgrespro","description":null,"archived":false,"fork":false,"pushed_at":"2021-02-12T11:57:02.000Z","size":15,"stargazers_count":9,"open_issues_count":1,"forks_count":4,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-04-24T10:48:42.975Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/postgrespro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-23T11:42:51.000Z","updated_at":"2024-12-30T04:45:30.000Z","dependencies_parsed_at":"2022-08-13T19:00:27.984Z","dependency_job_id":null,"html_url":"https://github.com/postgrespro/plantuner","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postgrespro%2Fplantuner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postgrespro%2Fplantuner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postgrespro%2Fplantuner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postgrespro%2Fplantuner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/postgrespro","download_url":"https://codeload.github.com/postgrespro/plantuner/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250766957,"owners_count":21483894,"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":[],"created_at":"2024-11-10T17:27:23.427Z","updated_at":"2025-04-25T06:30:27.655Z","avatar_url":"https://github.com/postgrespro.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/postgrespro/plantuner.svg?branch=master)](https://travis-ci.org/postgrespro/plantuner)\n[![GitHub license](https://img.shields.io/badge/license-PostgreSQL-blue.svg)](https://raw.githubusercontent.com/postgrespro/jsquery/master/LICENSE)\n\n# Plantuner - enable planner hints\n\n   `plantuner` is a contribution module for PostgreSQL 9.5+, which\n   enable planner hints.\n\n   All work was done by Teodor Sigaev (teodor@sigaev.ru) and Oleg Bartunov\n   (oleg@sai.msu.su).\n\n   Sponsor: Nomao project (http://www.nomao.com)\n\n## Motivation\n\nWhether somebody think it's bad or not, but sometime it's very\ninteresting to be able to control planner (provide hints, which tells\noptimizer to ignore its algorithm in part), which is currently\nimpossible in POstgreSQL. Oracle, for example, has over 120 hints, SQL\nServer also provides hints.\n\nThis first version of plantuner provides a possibility to hide\nspecified indexes from PostgreSQL planner, so it will not use them.\n\nThere are many situation, when developer want to temporarily disable\nspecific index(es), without dropping them, or to instruct planner to\nuse specific index.\n\nNext, for some workload PostgreSQL could be too pessimistic for\nnewly created tables and assumes much more rows in table than\nit actually has. If plantuner.fix_empty_table GUC variable is set\nto true then module will set to zero number of pages/tuples of\ntable which hasn't blocks in file.\n\n## Installation\n\nGet the latest source code.\n\n\texport USE_PGXS=1\n\tgmake\n\tgmake install\n\tgmake installcheck\n\n## Syntax\n\n* `plantuner.forbid_index` (deprecated)\n* `plantuner.disable_index`\n\t\n\tList of indexes invisible to planner\n* `plantuner.enable_index`\n\t\n\tList of indexes visible to planner even they are hided by plantuner.disable_index. \n\n## Usage\n\nTo enable the module you can either load shared library `plantuner` in\npsql session or specify `shared_preload_libraries` option in\n`postgresql.conf`.\n   \n```\n=# LOAD 'plantuner';\n=# create table test(id int);\n=# create index id_idx on test(id);\n=# create index id_idx2 on test(id);\n=# \\d test\n     Table \"public.test\"\n Column |  Type   | Modifiers\n--------+---------+-----------\n id     | integer |\nIndexes:\n    \"id_idx\" btree (id)\n    \"id_idx2\" btree (id)\n=# explain select id from test where id=1;\n                              QUERY PLAN\n-----------------------------------------------------------------------\n Bitmap Heap Scan on test  (cost=4.34..15.03 rows=12 width=4)\n   Recheck Cond: (id = 1)\n   -\u003e  Bitmap Index Scan on id_idx2  (cost=0.00..4.34 rows=12 width=0)\n         Index Cond: (id = 1)\n(4 rows)\n=# set enable_seqscan=off;\n=# set plantuner.disable_index='id_idx2';\n=# explain select id from test where id=1;\n                              QUERY PLAN\n----------------------------------------------------------------------\n Bitmap Heap Scan on test  (cost=4.34..15.03 rows=12 width=4)\n   Recheck Cond: (id = 1)\n   -\u003e  Bitmap Index Scan on id_idx  (cost=0.00..4.34 rows=12 width=0)\n         Index Cond: (id = 1)\n(4 rows)\n=# set plantuner.disable_index='id_idx2,id_idx';\n=# explain select id from test where id=1;\n                               QUERY PLAN\n-------------------------------------------------------------------------\n Seq Scan on test  (cost=10000000000.00..10000000040.00 rows=12 width=4)\n   Filter: (id = 1)\n(2 rows)\n=# set plantuner.enable_index='id_idx';\n=# explain select id from test where id=1;\n                              QUERY PLAN\n-----------------------------------------------------------------------\n Bitmap Heap Scan on test  (cost=4.34..15.03 rows=12 width=4)\n   Recheck Cond: (id = 1)\n   -\u003e  Bitmap Index Scan on id_idx  (cost=0.00..4.34 rows=12 width=0)\n         Index Cond: (id = 1)\n(4 rows)\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostgrespro%2Fplantuner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpostgrespro%2Fplantuner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostgrespro%2Fplantuner/lists"}