Skip to content

Commit 9f39cad

Browse files
authored
chore: remove text_pattern_ops index on phone column (#2266)
We have an existing `UNIQUE` index on the `phone` column (`users_phone_key`) that can be reused for: 1. Exact match queries 2. Prefixed search queries (`phone LIKE '123%'`) or range-based queries (`phone > '123' AND phone < '123'`) 3. Order by clauses `ORDER BY phone` `text_pattern_ops` indexes do not support ordering.
1 parent 7345c01 commit 9f39cad

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

internal/indexworker/indexworker.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -308,12 +308,6 @@ func getUsersIndexes(namespace, trgmSchema string) []struct {
308308
query: fmt.Sprintf(`CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_users_email_trgm
309309
ON %q.users USING gin (email %s.gin_trgm_ops);`, namespace, trgmSchema),
310310
},
311-
// enables exact-match and prefix searches and sorting by phone number
312-
{
313-
name: "idx_users_phone_pattern",
314-
query: fmt.Sprintf(`CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_users_phone_pattern
315-
ON %q.users USING btree (phone text_pattern_ops);`, namespace),
316-
},
317311
// for range queries and sorting on created_at and last_sign_in_at
318312
{
319313
name: "idx_users_created_at_desc",

0 commit comments

Comments
 (0)