⚡ [#538] Optimize objects list performance#540
Merged
Conversation
db3a6cd to
cb45ab2
Compare
b29a2ca to
9c8d3db
Compare
the filter to only include the objectrecords with the highest index per object was causing major performance degradations, especially in combination with filters on data_attrs.
Instead of using `Max(...)` together with GROUP BY, we now use Window to figure out the max index per object which is more efficient for larger datasets
stevenbal
commented
Mar 4, 2025
| assert result.status_code == 200 | ||
| assert result.json()["count"] == 5000 | ||
|
|
||
| benchmark_assertions(mean=1, max=1) |
Collaborator
Author
There was a problem hiding this comment.
Not sure yet if this will be the approach for the future, but at least this prevents performance from degrading to response times worse than 1s for the list endpoint
I want to look at https://docs.codspeed.io/benchmarks/python at some point to see if we can also track regressions.
danielmursa-dev
approved these changes
Mar 5, 2025
Contributor
danielmursa-dev
left a comment
There was a problem hiding this comment.
Looks good for me, I also tested it locally and it works.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #538
Reduces the response time of
GET /api/v2/objectsfrom about ~8.6s to ~0.26s (for a query that returns 5000 objects)Changes
Failing performance test before the changes: https://github.com/maykinmedia/objects-api/actions/runs/13653707936/job/38167868135