This PR add some fixes for the DB performance, notably by adding indexes on foreign keys, by reducing our usage of the ilike for username matching in favor of eq (=), and by creating 2 materialized views for 2 queries comments_count and reactions_count, since materialized views don't get automatically updated, i created a trigger that will update them on INSERT & DELETE on the corresponding tables.
fixes #93
Type of Change
[x] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
Description
This PR add some fixes for the DB performance, notably by adding indexes on foreign keys, by reducing our usage of the
ilike
for username matching in favor ofeq (=)
, and by creating 2 materialized views for 2 queriescomments_count
andreactions_count
, since materialized views don't get automatically updated, i created a trigger that will update them on INSERT & DELETE on the corresponding tables.fixes #93
Type of Change