Hacker News new | ask | show | jobs
by papersmith 5861 days ago
I think for that you'll have to use the ltree index, rather than regular string index, else it'll sort like this:

1/2/3

11/2/3

2/2/3

I wonder if there're ltrees for other DBs.

1 comments

That, or restrict the maximum number of comments at a given level to a large, but fixed number that you can express as a fixed size number, say two digits in base 62 (digits are 0-9a-zA-Z). Or, if you use postgres, make the index column a list of integers.