Skip to content

Conversation

@adrien2p
Copy link
Member

@adrien2p adrien2p commented Nov 28, 2025

What

After many runs, we can see that with a medium catalog the performances for updating a product are as follow:

before:      3500-5300ms
after:       70-100ms

The primary change in this PR addresses a performance issue related to the query strategy used during data fetching.

Previously, the service layer was fetching data without specifying a strategy, which defaulted to the joined strategy. This approach retrieved all related data in a single query with
multiple JOINs, putting significant stress on the database when dealing with large datasets — resulting in substantially increased query times.

The repository layer already had logic to apply pagination based on the input size and force the select-in strategy in those cases. This PR ensures the service layer also leverages
this optimization, preventing the joined strategy from being used when it would be detrimental to performance.

Key improvement: By using the select-in strategy, the database handles smaller, more efficient queries instead of a single heavy JOIN query, dramatically reducing query execution time.

@changeset-bot
Copy link

changeset-bot bot commented Nov 28, 2025

⚠️ No Changeset found

Latest commit: 9f92f2e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Nov 28, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

8 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
api-reference Ignored Ignored Nov 28, 2025 1:07pm
api-reference-v2 Ignored Ignored Nov 28, 2025 1:07pm
cloud-docs Ignored Ignored Nov 28, 2025 1:07pm
docs-ui Ignored Ignored Nov 28, 2025 1:07pm
docs-v2 Ignored Ignored Nov 28, 2025 1:07pm
medusa-docs Ignored Ignored Nov 28, 2025 1:07pm
resources-docs Ignored Ignored Nov 28, 2025 1:07pm
user-guide Ignored Ignored Nov 28, 2025 1:07pm

@NicolasGorga
Copy link
Contributor

Relates to #13783 . We can close the issue after this and the PR for CORE-1296 is merged

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants