Indexes
Last updated
Was this helpful?
Last updated
Was this helpful?
Database indexes are essential for performance. In particular you will need indexes to speed up search requests.
Aidbox provides mechanisms to
manage indexes
suggest indexes
generate indexes automatically
Aidbox uses database for storage. Most of resource data is contained in column with type.
Consider simple example: active search parameter for Patient resource.
Let's try the search query
Use to find out SQL query generated by this request
Possible response is
Corresponding SQL is
Without indexes Postgres has to check this condition for every Patient resource stored in the database.
We can create GIN index for the resource
column
Now Postgres can use this index to make search much faster.
Consider more complex example: name
search parameter for Patient
resource.
Request
Generates SQL like
You can create functional index to speed up this query:
Aidbox provides two RPCs that can suggest you indexes
Use aidbox.index/suggest-index
RPC to get index suggestion for specific search parameter
Use aidbox.index/suggest-index-query
RPC to get index suggestions based on query
Here is containment operator. It tests whether jsonb value on the right-hand side is contained in the jsonb value on the left-hand side.
However, can speed up these kind of queries.
Postgres' supports index searches for ILIKE
queries.