'raise the control rods by 1 inch'
vs
'raise the control rods to a height of 4 inches'133 karma · joined May 6, 2014
'raise the control rods by 1 inch'
vs
'raise the control rods to a height of 4 inches'postgres requests an id from the sequence for each row of the incoming data ahead of time since it doesn't know which rows are updates and which are inserts (although presumably this could be changed?). the sequence doesn't reset down for the unused so this can eat through it unexpectedly quickly if you have a table with a relatively large volume of updates.
also as a tip if you hit the max integer for the sequence and need space to implement a fundamental fix you can quickly change the sequence to start at -1 and go down. there's no issue with negative ids since they're also integers.
"Watch your thoughts, they become your words;
watch your words, they become your actions;
watch your actions, they become your habits;
watch your habits, they become your character;
watch your character, it becomes your destiny."
if you hit the max integer for the sequence and need space to implement a fundamental fix you can quickly change the sequence to start at -1 and go down. there's no issue with negative ids since they're also integers.
The use cases will likely diverge in the future, and if the functions are DRY'd making changes will make introducing bugs from the calling code that you're not working on easy. Eventually the single function will likely have a lot of conditions in it, which is a red flag for this situation.
https://kristinposehn.substack.com/p/ramanujan-dreams?r=feux...
Small tribes of humans defending hunting/foraging grounds is a state of pre-civilization. Life required work then too, and things were worse. His premise is that things used to be better and we've made it worse. Hard disagree.
All land / resources were staked out by small tribes of humans who might kill you for using it?
The top result is also a bottle opener... https://www.amazon.com/seat-belt-buckle-alarm-stopper/s?k=se...
One unobvious (to me) but possibly necessary side effect of the INSERT...ON CONFLICT pattern is that it reserves a primary id for every row ahead of time, presumably because it does not know what will be updated and what will be inserted. We have a heavily updated table that started failing inserts one day because the primary id sequence hit the max int (2.1b), despite the table only reaching 100mm rows. The immediate fix was to reset the sequence to -1 and have it start going down...