SpGistIndex
This class represents a Space-Partitioned Generalized Search Tree (SP-GiST) index for PostgreSQL databases. It allows for the creation of non-balanced disk-based data structures that support a wide range of different search patterns. The class supports optional configuration of the fillfactor parameter to optimize index storage and performance.
Attributes
| Attribute | Type | Description |
|---|---|---|
| suffix | string = spgist | The storage engine suffix used to identify the SP-GiST index type in generated SQL. |
| fillfactor | integer | The percentage of each index page that will be filled during index creation to allow for future growth. |
Constructor
Signature
def SpGistIndex(
*expressions: any,
fillfactor: int = None,
**kwargs: any
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| *expressions | any | Positional arguments representing the expressions to be indexed. |
| fillfactor | int = None | An integer value between 10 and 100 that determines how full the index pages will be packed. |
| **kwargs | any | Additional keyword arguments passed to the base Index class. |
Signature
def SpGistIndex(
*expressions: any,
fillfactor: int,
**kwargs: any
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| *expressions | any | Positional arguments representing the columns or expressions to be indexed. |
| fillfactor | int | The fillfactor percentage for the index, which determines how packed the index pages will be. |
| **kwargs | any | Additional keyword arguments passed to the base PostgresIndex class. |
Methods
deconstruct()
@classmethod
def deconstruct() - > tuple
Returns a 3-tuple of the index's constructor path, positional arguments, and keyword arguments for serialization.
Returns
| Type | Description |
|---|---|
tuple | A tuple containing the import path, positional arguments, and a dictionary of keyword arguments including the fillfactor. |
get_with_params()
@classmethod
def get_with_params() - > list
Builds a list of storage parameter strings to be used in the SQL WITH clause for index creation.
Returns
| Type | Description |
|---|---|
list | A list of strings formatted as 'parameter = value', such as 'fillfactor = 90'. |