4 ms·
Actually, now that I think about it, step 1 isn't necessary. You don't actually need to shuffle the indexes since you always choose a random one anyway. It shou
by munificent 3y ago
Actually, now that I think about it, step 1 isn't necessary. You don't actually need to shuffle the indexes since you always choose a random one anyway. It should be enough to just do the swap on deletes in order to keep the integers contiguous.
> I think you'll need a full table lock in case you're ever trying to do a remove and add at the same time
Yeah, I think you need some sort of locking to ensure N can't be concurrently modified but I'm not a DB person, so I don't know how to go about that.
- crazygringo 3y agoYup, agreed on step 1. Basic autoincrement is perfectly fine, since you pick a random number at query time.
- Levitating 3y agoWhat an incredibly simple solution for something that was just deemed rocket science. Also I liked your book.