Skip to content

Index in-stock product catalog queries - #119

Draft
ldennington wants to merge 1 commit into
mainfrom
copilot/task-11321782-1234088552-1a3a0392-1e0a-4012-9994-59f1f36527c0
Draft

ldennington wants to merge 1 commit into
mainfrom
copilot/task-11321782-1234088552-1a3a0392-1e0a-4012-9994-59f1f36527c0

Conversation

@ldennington

@ldennington ldennington commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Identified ten performance opportunities and selected the catalog index as the highest-impact, lowest-effort change.

  • Implemented: Add a composite index matching the catalog’s inStock filter and newest-first ordering.
    @@index([inStock, createdAt(sort: Desc)])
  • Other opportunities identified: Paginate catalog results; cap search results; add trigram search indexes; narrow selected fields; cache catalog reads; index order-item foreign keys; cancel superseded searches; prioritize the first visible product image; tune connection-pool limits.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 16, 2026 15:05
@ldennington ldennington changed the title Improve product catalog query performance Index in-stock product catalog queries Nov 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approved

No active review issues are reported for the catalog index changes in the Prisma schema and SQL migration.

No open issues 🎉

What changed in this PR

Adds a composite database index to support the catalog’s in-stock filtering and newest-first ordering without changing application query behavior.

Changes:

  • Declares a Product index on inStock and descending createdAt in Prisma.
  • Adds a SQL migration to create the matching database index.
File Description
prisma/​schema.prisma Defines the composite Product catalog index.
prisma/​migrations/​20261116150300_add_product_catalog_index/​migration.sql Creates the index in the database.

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants