From 230bdc5e31eeb890c116bed4af80357744d4bb60 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Mar 2026 19:41:51 +0000 Subject: [PATCH 1/2] Initial plan From 53bb55ec5525ab0d0ea01f59568603d4bf5cb14b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Mar 2026 19:47:38 +0000 Subject: [PATCH 2/2] perf: add index on grants(grantee_address) for fast grantees/users query Co-authored-by: rickyrombo <3690498+rickyrombo@users.noreply.github.com> --- ddl/migrations/0191_grants_grantee_address_idx.sql | 7 +++++++ sql/01_schema.sql | 7 +++++++ 2 files changed, 14 insertions(+) create mode 100644 ddl/migrations/0191_grants_grantee_address_idx.sql diff --git a/ddl/migrations/0191_grants_grantee_address_idx.sql b/ddl/migrations/0191_grants_grantee_address_idx.sql new file mode 100644 index 00000000..adb02c37 --- /dev/null +++ b/ddl/migrations/0191_grants_grantee_address_idx.sql @@ -0,0 +1,7 @@ +begin; + +CREATE INDEX IF NOT EXISTS idx_grants_grantee_address +ON grants(grantee_address, is_revoked, created_at DESC) +WHERE is_current = true; + +commit; diff --git a/sql/01_schema.sql b/sql/01_schema.sql index e237200d..0256c531 100644 --- a/sql/01_schema.sql +++ b/sql/01_schema.sql @@ -11096,6 +11096,13 @@ CREATE INDEX idx_fanout_not_deleted ON public.follows USING btree (follower_user CREATE INDEX idx_genre_related_artists ON public.aggregate_user USING btree (dominant_genre, follower_count, user_id); +-- +-- Name: idx_grants_grantee_address; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX idx_grants_grantee_address ON public.grants USING btree (grantee_address, is_revoked, created_at DESC) WHERE (is_current = true); + + -- -- Name: idx_lower_wallet; Type: INDEX; Schema: public; Owner: - --