{"id":22325901,"url":"https://github.com/jamesbriggs/mysql-permute-indexes","last_synced_at":"2025-07-29T16:33:39.215Z","repository":{"id":23531060,"uuid":"26897717","full_name":"jamesbriggs/mysql-permute-indexes","owner":"jamesbriggs","description":"Generate all valid indexes for MySQL EXPLAIN to optimize complex queries automatically (SQL index knockout)","archived":false,"fork":false,"pushed_at":"2014-12-03T05:04:56.000Z","size":164,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-07-15T22:11:29.990Z","etag":null,"topics":["mysql","oracle","perl","postgresql"],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jamesbriggs.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":"2014-11-20T05:44:08.000Z","updated_at":"2024-07-15T22:11:29.991Z","dependencies_parsed_at":"2022-08-22T00:50:45.199Z","dependency_job_id":null,"html_url":"https://github.com/jamesbriggs/mysql-permute-indexes","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesbriggs%2Fmysql-permute-indexes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesbriggs%2Fmysql-permute-indexes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesbriggs%2Fmysql-permute-indexes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesbriggs%2Fmysql-permute-indexes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamesbriggs","download_url":"https://codeload.github.com/jamesbriggs/mysql-permute-indexes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228030009,"owners_count":17858432,"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":["mysql","oracle","perl","postgresql"],"created_at":"2024-12-04T02:14:21.655Z","updated_at":"2024-12-04T02:14:22.216Z","avatar_url":"https://github.com/jamesbriggs.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"mysql-permute-indexes\n=====================\n\n**Summary**\n\nAutogenerate all valid index statements for EXPLAIN to optimize complex queries automatically for MySQL, Postgres, Oracle and SQL Server.\n\nSome use cases:\n\n- accelerate existing Open Source (WordPress, Joomla, etc.) and commercial applications\n- test database optimizer results\n- stress-test databases with hundreds of index objects\n- verify understanding of optimizer index selection  behavior by DBA\n- and the most interesting to me, improve performance of infrastructure tools that use metadata stores (OpenStack, CloudStack, DynamoDB, Bacula, etc.) \n\nTypical performance improvements are 100x to 1,000x for multi-table joins, subselect and reporting queries.\n\n**Example**\n\n\u003cpre\u003e\n$ vi permute_index.pl # (update user settings)\n\n$ permute_index.pl | tee permute_index.txt\n   alter table t1 add index idx_jb_001 (c1,c3);\n   alter table t1 add index idx_jb_002 (c1,c2,c3);\n   alter table t1 add index idx_jb_003 (c1,c3,c2);\n   [...]\n   alter table t2 add index idx_jb_007 (c4,c5);\n   [...]\n\n# load a backup or representative dataset to a dev system (do not run in production!)\n\n$ mysql -h dev -u root -p test \u0026lt;permute_index.txt\n\n$ mysql -h dev -u root -p test\n  mysql\u0026gt; explain select * from t1, t2 where c1=c4 and c1=? and c2=? and c3=? and c5=?;\n  Table | Key\n  ------------------\n  t1    | idx_jb_002\n  t2    | idx_jb_007\n\n(Now drop all the autogenerated indexes except idx_jb_002 and idx_jb_007.)\n\u003c/pre\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesbriggs%2Fmysql-permute-indexes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamesbriggs%2Fmysql-permute-indexes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesbriggs%2Fmysql-permute-indexes/lists"}