New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve ML reactivity when there are many files #15221
Conversation
Codecov ReportBase: 60.34% // Head: 60.34% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## main #15221 +/- ##
=======================================
Coverage 60.34% 60.34%
=======================================
Files 1367 1367
Lines 33268 33268
Branches 6353 6353
=======================================
Hits 20076 20076
Misses 11347 11347
Partials 1845 1845
Flags with carried forward coverage won't be shown. Click here to find out more. Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
{ | ||
name: `upload_files_created_at_index`, | ||
columns: ['created_at'], | ||
type: null, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Read a conversation somewhere about indexes in strapi.
If I recall correctly, this is not ready for the public yet, but I imagine you can still use this syntax in any of your content-types right?
What work would be needed to make it public? Specify the list of fields you want to index to automatically generate a index name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes exactly :) and to convert the field name to the database column name (createdAt
=> updatedAt
). Also some thinking to have about columns that don't appear in the user schema (like createdAt and updatedAt)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, using sqlite I see a very little increment in the disk when the indexes are added indeed.
Seeing this PR I am thinking of preparing some performance tests in the future, to spot which parts are slower and to decide when to use indexes.
What does it do?
Add indexes for sortable columns of files
Why is it needed?
When files are retrieved, they are sorted by a field like
created_at
. When there are many files, like 300k, the API response becomes slower (~1 to 2 sec). Adding an index improve the speed of the sort operation.How to test it?
Related issue(s)/PR(s)
Fix #14954