Discussion about this post

User's avatar
Jp's avatar

I'm not sure if I really understood the example; both the primary key and a (missing, but certainly will be required) created_at timestamp would be excellent candidates for sorting of comments; Using a integer seq_num field is actually the worst possible implementation I can think of, as it will most certainly require reading a previous record to determine the value on every insert, and exposes sorting to applicational bugs (concurrency issues when inserting multiple comments at once, ensure the value is not negative, etc).

Expand full comment
6 more comments...

No posts