4 ms·
BETWEEN is soemthing that is on the "Don't do this" page of Postgres. :) https://wiki.postgresql.org/wiki/Don%27t_Do_This#Don.27t_use_BETWEEN_.28especially_wit
by manish_gill 7y ago
BETWEEN is soemthing that is on the "Don't do this" page of Postgres. :)
https://wiki.postgresql.org/wiki/Don%27t_Do_This#Don.27t_use_BETWEEN_.28especially_with_timestamps.29 https://wiki.postgresql.org/wiki/Don%27t_Do_This#Don.27t_use...
the ::text[] addition had no impact on perf. I actually constructed this post from my notes at the time so might missed have a few things here and there.
The bit about query planner recognizing things is exactly what the challenge is to be honest. Like I said at the end, the good mental model of SQL helps a lot, and mine is decent-ish I hope but can still learn a lot. :)
- Someone 7y agoThat’s why I added the +1 and -1 fragments :-) I thought those computed the smallest larger/largest smaller time stamp. I didn’t realize that time stamps weren’t integers in PostgreSQL, though, so that is a bug. Are you sure your query, which uses an interval that is open at both ends, is correct?