DEV Community

Discussion on: 1 SQL Query You Should Stop Using

Collapse
lukecarrier profile image
Luke Carrier

How would you approach this problem if you're using UUIDs instead of numeric IDs? I think you'd need a separate sort order column whose value is derived from a sequence?

Collapse
abdisalan_js profile image
Abdisalan Author

Exactly, in order to benefit from this you need a field that you can order your data by.
A common example is using the created_at field along with your UUID to break ties.

There's a deeper explanation here if you'd like
use-the-index-luke.com/no-offset