From c67f5cd10be91fbb6fa9a6490e5ecaa800954905 Mon Sep 17 00:00:00 2001 From: Justin Barnyak Date: Tue, 16 Dec 2025 17:53:31 -0500 Subject: [PATCH] feat-extra-indexes-for-performance: a few indexes I think would help --- .../20251216173234_add_performance_indexes.sql | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 supabase/migrations/20251216173234_add_performance_indexes.sql diff --git a/supabase/migrations/20251216173234_add_performance_indexes.sql b/supabase/migrations/20251216173234_add_performance_indexes.sql new file mode 100644 index 0000000..8403ea8 --- /dev/null +++ b/supabase/migrations/20251216173234_add_performance_indexes.sql @@ -0,0 +1,16 @@ +-- fk lookup indexes +create index if not exists index_hack_covers_hack_slug on public.hack_covers(hack_slug); +create index if not exists index_hack_tags_hack_slug on public.hack_tags(hack_slug); +create index if not exists index_patches_parent_hack on public.patches(parent_hack); + +-- analytics date range queries +create index if not exists index_patch_downloads_created_at on public.patch_downloads(created_at); + +-- discover page sorts +create index if not exists index_hacks_downloads_desc on public.hacks(downloads desc) where approved = true; +create index if not exists index_hacks_updated_at_desc on public.hacks(updated_at desc) where approved = true; + +-- discover filtering +create index if not exists index_hacks_base_rom on public.hacks(base_rom) where approved = true; +create index if not exists index_hacks_original_author on public.hacks(original_author) where original_author is not null; +