Skip to main content

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

AttributeTypeDescription
suffixstring = spgistThe storage engine suffix used to identify the SP-GiST index type in generated SQL.
fillfactorintegerThe 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

NameTypeDescription
*expressionsanyPositional arguments representing the expressions to be indexed.
fillfactorint = NoneAn integer value between 10 and 100 that determines how full the index pages will be packed.
**kwargsanyAdditional keyword arguments passed to the base Index class.

Signature

def SpGistIndex(
*expressions: any,
fillfactor: int,
**kwargs: any
) - > null

Parameters

NameTypeDescription
*expressionsanyPositional arguments representing the columns or expressions to be indexed.
fillfactorintThe fillfactor percentage for the index, which determines how packed the index pages will be.
**kwargsanyAdditional 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

TypeDescription
tupleA 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

TypeDescription
listA list of strings formatted as 'parameter = value', such as 'fillfactor = 90'.