Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support creating different index types #417

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

kvch
Copy link
Contributor

@kvch kvch commented Oct 18, 2024

This PR adds new options to create_index operation:

  • method: enum for setting different index types. Default: btree. Available options: btree, hash, gist, spgist, gin, brin.
  • storage_parameters: optional storage parameters for the index.

Example operation to create a new hash index with custom fillfactor:

{
  "name": "10_create_index",
  "operations": [
    {
      "create_index": {
        "name": "idx_fruits_name",
        "table": "fruits",
        "columns": [
          "name"
        ],
	"method": "hash",
	"storage_parameters": "fillfactor = 70"
      }
    }
  ]
}

Furthermore, analyze now return the index method under the name method and the definition under definition.
Please note that the definition pgroll returns is not the SQL statement pgroll runs when running create_index migrations.

{
 "idx_fruits_name": {
   "name": "idx_fruits_name",
   "unique": false,
   "columns": [
     "name"
   ],
   "method": "hash",
   "definition": "CREATE INDEX idx_fruits_name ON public.fruits USING hash (name) WITH (fillfactor='70')"
 }
}

Closes #378

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow creating different types of indexes and/or return more information about an index type
1 participant