Postgresql – How to performantly self-join same table multiple times with ascending and descending sort order?
Data Definition I have a status table like so, attributes not relevant to the question are omitted: id created value 1 2024-06-24T13:01:00 error 2 2024-06-24T13:02:00 ok 3 2024-06-24T13:03:00 warning 4 2024-06-24T13:04:00 error 5 2024-06-24T13:05:00 error 6 2024-06-24T13:05:30 error 7 2024-06-24T13:06:00…