Files
threshold/internal/db/schema
Timothy Messier 091ed6bacb perf(db): Reorder index columns for primary keys
When processing a controller API request, system uses a query to fetch
the grants for the requesting user. This query requires pulling together
information from several tables, and is currently performing many
sequential scans to do so. For a number of the tables involved, there
are indexes from multi-column primary keys, however, due to the order of
the columns in the index, the postgres planner would need to do a full
scan of the index, which can be less efficient than a sequential scan,
so instead it will perform a sequential scan of the table.

This recreates the primary keys while swapping the order of the columns
in the primary key definition, and thus the order in the index. By doing
so, the planner will not need to perform a full index scan, and will be
more likely to use the index when executing the grants query.

(cherry picked from commit 5577b3c358e9d45cd7ec02fc951e45d52e50595e)
2024-09-24 14:18:54 +00:00
..
2024-02-13 15:50:11 -05:00
2023-08-11 10:31:53 -07:00
2023-08-11 10:31:53 -07:00
2024-02-16 08:30:16 -05:00
2023-08-11 10:31:53 -07:00
2023-08-11 10:31:53 -07:00
2023-08-11 10:31:53 -07:00