This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
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.
Fix background update to use an index #14181
Fix background update to use an index #14181
Changes from 6 commits
f06885c
e036bf2
872b915
3044652
6af4689
eae6ed4
d0325ef
b4711a3
b4e1eda
56f7d4c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
are we expecting many
thread_id
s to be NULL? If not, this query may read a lot of rowsThere 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.
Yeah, pretty much everything should be NULL. I was toying with changing it, but note that this is the same behaviour as before.
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.
Everything is
NULL
to start with...if we think there isn't that many summaries we can just try to do it all at once, but I suspect this table is quite large.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.
Oh, actually, there's an issue with this because of the OFFSET. If you don't have a number of rows divisible by the batch size, we'll get some rows 'left over'. You'd have to do a final pass with
> (min_user_id, min_room_id)
? :/Alternatively: do an
UPDATE .. RETURNING
and userows[-1]
as the next min(?? is there a LIMIT for updates?)
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.
I thought about different ways of doing this, in the end i just made it not include an upper bound if we don't have an upper bound.