You've already forked AstralRinth
forked from didirus/AstralRinth
perf(labrinth/random_projects_get): speed up through spatial queries according to profiling results (#3762)
This commit is contained in:
committed by
GitHub
parent
858c7e393f
commit
a3839461cf
@@ -0,0 +1,12 @@
|
||||
-- The spatial query for retrieving random searchable projects is greatly sped
|
||||
-- up by this index on a fixture of 1M mods, bringing down the total cost of
|
||||
-- the query plan and runtime to be comparable to primary key lookups. See the
|
||||
-- `labrinth::routes::v3::projects::random_projects_get` function and the
|
||||
-- previous 20250608183828_random-project-index.sql migration for more details.
|
||||
--
|
||||
-- That previous migration created a non-spatial index for the status column which
|
||||
-- does not get used in the new spatial query, but may still be useful for other
|
||||
-- queries that filter mods by status.
|
||||
|
||||
CREATE INDEX mods_searchable_ids_gist ON mods USING gist (POINT(id, 0))
|
||||
WHERE status = ANY(ARRAY['approved', 'archived']);
|
||||
Reference in New Issue
Block a user