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
| Attribute | Type | Description |
|---|---|---|
| suffix | string = "gin" | The SQL index type suffix used to identify the Generalized Inverted Index (GIN) in the database schema. |
| fastupdate | boolean | A boolean flag that enables or disables the GIN fast update technique to speed up index insertions. |
| gin_pending_list_limit | integer | The 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
| Name | Type | Description |
|---|---|---|
| *expressions | any | Positional arguments representing the expressions or columns to be indexed. |
| fastupdate | boolean = None | A boolean to enable or disable the GIN fast update feature. |
| gin_pending_list_limit | integer = None | Sets the maximum size of the GIN pending list. |
| **kwargs | any | Additional 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
| Name | Type | Description |
|---|---|---|
| *expressions | any | The column names or expressions that make up the index. |
| fastupdate | boolean = None | A boolean flag to enable or disable the GIN fast update feature for faster insertions. |
| gin_pending_list_limit | integer = None | The maximum size in kilobytes for the GIN pending list before it is merged into the main index structure. |
| **kwargs | any | Additional 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
| Type | Description |
|---|---|
tuple | A 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
| Type | Description |
|---|---|
array | A list of formatted strings representing the PostgreSQL storage parameters for the index. |