The surprisingly difficult problem of user-defined order in SQL

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • mudderjs

    Lexicographically-subdivide the “space” between strings, by defining an alternate non-base-ten number system using a pre-defined dictionary of symbol↔︎number mappings. Handy for ordering NoSQL keys.

    I have solved this problem for my own purposes — no claims of grand scalability or high efficiency — by storing indices or "ranks" of items as strings (Postgres TEXT) using a library called mudderjs[0] and a thin wrapper around it[1]. Sorted lexicographically (in dictionary order) arbitrary-length strings have arbitrary precision. You can always find a string between any two strings; for instance, between "a" and "b" is "am" and between "a" and "ab" is "aam". You do have to have the entire ordered collection in scope to generate a new rank for an item, but reordering an item only requires updating one row and isn't subject to floating point precision.

    [0] https://github.com/fasiha/mudderjs

    [1] https://github.com/pubpub/pubpub/blob/master/utils/rank.ts

  • Awesome Nested Set

    An awesome replacement for acts_as_nested_set and better_nested_set.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts