Fredkiss3 / gh-next

A minimal Github clone built on nextjs app router.
https://gh.fredkiss.dev/
MIT License
450 stars 21 forks source link

Fix DB performance #99

Closed Fredkiss3 closed 12 months ago

Fredkiss3 commented 12 months ago

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 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

vercel[bot] commented 12 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gh-next ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 18, 2023 6:53pm