isomerpages / isomercms-backend

A static website builder and host for the Singapore Government
5 stars 1 forks source link

chore: index notifications table #1275

Closed alexanderleegs closed 6 months ago

alexanderleegs commented 6 months ago

Problem

Our notifications table is large, and we run frequent SELECT queries on it, but postgres does not automatically index foreign key columns, so WHERE clauses on these columns will require a full table scan, which results in inefficient db queries. This PR adds indexes to the foreign keys in the notifications table to speed up our queries.

Note that site_id is only indexed with user_id, since we never filter by site_id alone.

Deploy Notes