sa: truncate times in type converter#7556
Conversation
|
BTW thanks to @aarongable and @beautifulentropy for encouraging me to find a more systemic fix in #7519 (review). I did a version of this change where instead of truncating, it would panic if it received an untruncated time. It found a couple of call sites that I missed in #7519 which are probably pretty important to performance (SELECTs against time indexes that are called on new-order): Lines 75 to 77 in 8545ea8 Lines 131 to 133 in 8545ea8 |
|
Also, once this change lands I'll submit a separate revert of #7519. |
pgporada
left a comment
There was a problem hiding this comment.
Looks good to me, but I have a borp question.
Do queries wrapped in a (t *Transaction) get unwrapped for lack of a better term into their underlying (m *DbMap) so that both transactional and non-transactional queries run through m.convertArgs?
We create transactions using |
Version v1.5.0 was released in January 2020, over five years ago. We have attempted to update this package several times since then -- first to v1.6.0, later to v1.7.1 -- but have reverted the change due to nigh-inexplicable performance regressions each time. Since our last attempt, we believe we have addressed the underlying issue by truncating timestamps when we talk to the database (see #7556) so that our indices don't try to track nanosecond precision. We are now ready to reattempt updating this package to v1.7.1 again. If that goes well, we will further update it to the newest version. Fixes #5437 Part of #7872
We believe the MariaDB query planner generates inefficient query plans when a time index is queried using high precision (nanosecond) times. This uses the updated borp from letsencrypt/borp#11 to automatically truncate
time.Timeand*time.Timein query parameters.Part of #5437