Redundant composite index in many-to-many docs
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 90/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- postgresql
- Domain
- databases, documentation
Research direction
Start at the linked many-to-many relationships section and review the composite primary key and index example. Update the example so it no longer includes the redundant composite index, while retaining the single-column indexes; done when the documentation matches the proposed snippet.
Written by the indexing model from the issue text.
Description
The many-to-many relations documentation recommends creating a separate composite index on (userId, groupId) in addition to a composite primary key on (userId, groupId).
In PostgreSQL (and most other DBMSs), the PK already creates a unique index covering (userId, groupId), making the additional composite index redundant.
So this:
p.primaryKey({ columns: [t.userId, t.groupId] }),
p.index('users_to_groups_user_id_idx').on(t.userId),
p.index('users_to_groups_group_id_idx').on(t.groupId),
p.index('users_to_groups_composite_idx').on(t.userId, t.groupId), // <----- unnecessary
Should be:
p.primaryKey({ columns: [t.userId, t.groupId] }),
p.index('users_to_groups_user_id_idx').on(t.userId),
p.index('users_to_groups_group_id_idx').on(t.groupId),
- Dominant language
- MDX
- Stars
- 241
- Forks
- 402
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 4
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from drizzle-team/drizzle-orm-docs
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
drizzle-team/drizzle-orm-docs#716 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
drizzle-team/drizzle-orm-docs#705 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
drizzle-team/drizzle-orm-docs#681 · 2 reactions ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
drizzle-team/drizzle-orm-docs#676 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
drizzle-team/drizzle-orm-docs#652 · 1 comment ·
All issues in drizzle-team/drizzle-orm-docs
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
OpenLiberty/open-liberty#35839 ·
-
affects-9.0 found-by-ai may-affects-25.10 may-affects-26.3 may-affects-26.9 may-affects-7.5 may-affects-8.1 may-affects-8.5 severity/major sig/execution type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
antlr/grammars-v4#5014 · 1 comment ·
-
comp-query-execution fuzz
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121303 · 3 comments ·