perf(files/cache): SQL aggregation for folder size calculation#59586
perf(files/cache): SQL aggregation for folder size calculation#59586
Conversation
90d1746 to
4552fc8
Compare
32b7949 to
8bb31e0
Compare
I don't understand what the problem was and why it needed to be fixed. Multiple rows having the same etag is completely fine. The only important thing about the etag is that it changes, not that it's unique. |
|
Yep, the "uniqueness guarantee" framing suggests a bug that didn't exist... |
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
8bb31e0 to
3d5c987
Compare
I still see the changes to uniqid The sql aggregation looks fine to me |
| ->selectAlias($query->func()->min('size'), 'size_min') | ||
| ->selectAlias($query->func()->max('unencrypted_size'), 'unencrypted_max') | ||
| ->selectAlias( | ||
| $query->createFunction("SUM(CASE WHEN $unencryptedSizeCol > 0 THEN $unencryptedSizeCol ELSE $sizeCol END)"), |
There was a problem hiding this comment.
it would be nice to add case to the sql functionbuilder instead of having to do the manual getColumnName.
End result being something like
$query->func()->sum($query->func()->case($query->expr()->gt('unencrypted_size', $query->createParameter(0)), 'unencrypted_size', 'size'))
Summary
Replaces row-by-row PHP aggregation with a single SQL query using five aggregates an thus eliminating a second round-trip to the database that was a performance regression for encrypted storage.
Checklist
3. to review, feature component)stable32)AI (if applicable)