Indexes
Indexes are used to make read-queries and WHERE clauses faster, at the expense of slower inserts. The structure of an index is shown below:
{
"name": "my_index_1",
"table": "table1",
"columns": ["column1"],
"using": 101 // BTREE
}
The name field of an index is used as a unique identifier. Index names must be unique for the database they exist within.
The table field of an index specifies the table that the index is on. The columns field specifies the column(s) that the index is applied on.
In general, it is best practice to only apply indexes to a single column. Multi-column indexes should be used with discretion.
The index's using field specifies the type of index that is being applied. A list of index types and their enumerators can be found here.
Last modified 1mo ago