News for hackers. Stuff that matters.
Re:The Slotted Counter Pattern by elsurudo on Monday August 01, 2022 @12:39PM (#32308665)
Makes sense, but I can't help but feel it's a solution at the wrong abstraction level. It's a shame the DB can't figure this out for you.
Re:The Slotted Counter Pattern by yccs27 on Monday August 01, 2022 @12:48PM (#32308801)
Yeah, it seems like it would be possible for the DB engine to aggregate all these increments into one update. If you have two increments by one each in the queue, why not make it a single increment by two? I'm not sure though how much computing power it would need to figure that out...
Re:The Slotted Counter Pattern by LesZedCB on Monday August 01, 2022 @12:56PM (#32308917)
wouldn't that break the atomic and isolated rule of ACID?
Re:The Slotted Counter Pattern by samatman on Monday August 01, 2022 @02:04PM (#32309880)
Not necessarily. If both updates are in a single transaction then it's valid for the query planner to batch them, although that seems unlikely in the use case this table layout is designed for.
Re:The Slotted Counter Pattern by MauranKilom on Monday August 01, 2022 @04:30PM (#32311646)
Not any more than the slotted counter pattern...
Re:The Slotted Counter Pattern by LesZedCB on Monday August 01, 2022 @07:24PM (#32313413)
how does the shape of data impact the storage applications safety contract?
Re:The Slotted Counter Pattern by cryptonector on Monday August 01, 2022 @06:08PM (#32312684)
The DB could figure it out IF it had monoid counter type to use as the column's type.