Skip to main content

GinIndex

This class represents a Generalized Inverted Index (GIN) for PostgreSQL databases, designed to handle composite data types and full-text search. It allows for the configuration of index-specific storage parameters such as fastupdate and gin_pending_list_limit. The class extends the standard PostgreSQL index functionality to support efficient querying of multi-valued data.

Attributes

AttributeTypeDescription
suffixstring = "gin"The SQL index type suffix used to identify the Generalized Inverted Index (GIN) in the database schema.
fastupdatebooleanA boolean flag that enables or disables the GIN fast update technique to speed up index insertions.
gin_pending_list_limitintegerThe maximum size in kilobytes for the GIN pending list before it is flushed to the main index structure.

Constructor

Signature

def GinIndex(
*expressions: any,
fastupdate: boolean = None,
gin_pending_list_limit: integer = None,
**kwargs: any
) - > null

Parameters

NameTypeDescription
*expressionsanyPositional arguments representing the expressions or columns to be indexed.
fastupdateboolean = NoneA boolean to enable or disable the GIN fast update feature.
gin_pending_list_limitinteger = NoneSets the maximum size of the GIN pending list.
**kwargsanyAdditional keyword arguments passed to the parent PostgresIndex class.

Signature

def GinIndex(
*expressions: any,
fastupdate: boolean = None,
gin_pending_list_limit: integer = None,
**kwargs: any
)

Parameters

NameTypeDescription
*expressionsanyThe column names or expressions that make up the index.
fastupdateboolean = NoneA boolean flag to enable or disable the GIN fast update feature for faster insertions.
gin_pending_list_limitinteger = NoneThe maximum size in kilobytes for the GIN pending list before it is merged into the main index structure.
**kwargsanyAdditional keyword arguments passed to the base PostgresIndex class.

Methods


deconstruct()

@classmethod
def deconstruct() - > tuple

Returns a 3-tuple containing the path to the class and the arguments used to recreate the index instance, used for migrations.

Returns

TypeDescription
tupleA tuple of (path, args, kwargs) representing the serialized state of the index.

get_with_params()

@classmethod
def get_with_params() - > array

Generates the SQL WITH clause parameters specific to GIN indexes, such as fastupdate and gin_pending_list_limit.

Returns

TypeDescription
arrayA list of formatted strings representing the PostgreSQL storage parameters for the index.