Fix notifications index
An index was added to notifications by rinpatch 4 years ago:
create_if_not_exists(index(:notifications, ["id desc nulls last"]))
However, the code to query notifications was not using this index, calling ORDER BY id DESC
instead of ORDER BY id DESC NULLS LAST
like it should.
Updating the code makes notifications queries actually use the correct index, fixing a number of performance issues.
Edited by Alex Gleason