remove n^2 part of person triggers, improve community aggregate trigger #3739
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.
This PR has two changes:
person_aggregates_comment_count
andperson_aggregates_post_count
triggers. This part has never actually worked due to the use ofcoalesce(0, ...)
. See SQL Trigger/function 'person_aggregates_comment_count' is broken #2910 . In order to fix the function and not make it be too expensive, the triggers would have to get an enforced order or be merged into one trigger (some effort in post UPDATE trigger focused on all the combined actions of a byebye a… #3727, but incomplete so far)This is part of the solution to #3528. After this and #3732, the only expensive trigger remaining should be community_aggregates_post_count.