Comment

Comment by gurjeet

Use numeric data type instead of integer, and update the position to the midpoint of the other 2 you're trying to place the record between.

    update ... set position = (prev + next)/2;
To get better performance you can choose to use the float data type, but then you'd be limited to a fixed precision; sufficient for most cases, though.
parent gurjeet 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton