Indexes¶
If you want to add index to your TreeModel, use GistIndex from postgres.
Note
GistIndex was suggested based on @pauloxnet’s code sample from this microsoft Citus Con YouTube video
To implement the index in your model:
models.py¶
from django.contrib.postgres import indexes as idx
from django_ltree import TreeModel
class CustomTree(TreeModel):
...
class Meta:
indexes = [
idx.GistIndex(fields=["path"]),
]