Add database indexes for user-scoped queries
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 68/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- backend, databases, performance
Research direction
Start in LearnStack.Core/Data/ApplicationDbContext.cs by reviewing OnModelCreating and then inspect the existing migration setup. Apply the proposed indexes, seed roughly 10k resources, and compare execution plans for the resource list, Pulse, and content-ideas queries. Done means those queries show index usage with no table scans.
Written by the indexing model from the issue text.
Description
Tier 2 — scale
Problem
Every query in the app filters by UserId, and there is no index on UserId for LearningResources, ContentIdeas or SharedResourceGroups. The only indexes configured are the unique ones on ShareToken and invitation Token. Every page load is a table scan — and because thumbnails live on the same row (see #45), each scan drags the blobs with it.
Evidence
LearnStack.Core/Data/ApplicationDbContext.cs—OnModelCreatingdefines indexes only onSharedResourceGroup.ShareToken,FriendInvitation.Tokenand the friendship pair
Proposed fix
Add in a migration:
LearningResources (UserId, IsArchived, Status)LearningResources (UserId, IsPublic)filtered onIsPublic = 1ContentIdeas (UserId, Status)SharedResourceGroups (UserId)
Then confirm with actual execution plans on a seeded dataset.
Acceptance criteria
- No table scans on the resource list, Pulse or content-ideas pages
- Index usage verified against a dataset of ~10k resources
- Dominant language
- HTML
- Stars
- 10
- Forks
- 0
- Avg merge
- 3h 42m
- Merged PRs (30d)
- 14
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
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 kasuken/LearnStack
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 91/100
kasuken/LearnStack#59 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
kasuken/LearnStack#72 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 30/100
kasuken/LearnStack#71 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
kasuken/LearnStack#70 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 45/100
kasuken/LearnStack#69 ·
Maintainers usually reply within 1 day
All issues in kasuken/LearnStack
Similar issues
-
bug via-triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
pingdotgg/t3code#15221 · 1 comment ·
Maintainers usually reply within 1 day
-
API bug connectors
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
pyinfra-dev/pyinfra#1986 ·
Maintainers usually reply within 3 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
MystenLabs/MemWal#1084 · 1 comment ·
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 1/5 Under an hour Newbie friendliness 92/100
PhyberApex/kuroshiro#1187 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pimlicolabs/alto#767 ·