3 ms·
I've been there, and have the scars from it. In several cases, I have order by (id{primary key}+0) desc just to bust up the very strong bias to just backwards
by wiredfool 16y ago
I've been there, and have the scars from it.
In several cases, I have order by (id{primary key}+0) desc just to bust up the very strong bias to just backwards scan on the primary key till it fills the limit window. That's perfectly fine if you're looking at the end of a time series, but if you're actually looking 200k records back, even if stuff is cached in memory, that's a hell of a hit.
The case that first triggered that one was when the query planner went from a constant time lookup to that index scan, and took the time to do a large update from 10s of seconds to 12 hours.