Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Your strings could get REALLY long.

Suppose you have 3 items:

    id  pos  name
    1   'a'  apple
    2   'm'  banana
    3   'z'  cherry
You move cherry to the middle of the list. Now, you have:

    id  pos  name
    1   'a'  apple
    3   'g'  cherry
    2   'm'  banana
Now you move banana back to the middle of the list, which gives you this:

    id  pos  name
    1   'a'  apple
    2   'd'  banana
    3   'g'  cherry
Keep doing this, and the gap keeps shrinking. You need to make pos longer to be more precise to fit in the gap. Eventually you run out of space in your string field.


I read their response as not limiting themselves to a single character (which you have too, if I read you correctly). If they use a text column, it's practically arbitrarily large. I believe the limit is around 1GB in Postgres. They've also dismissed concerns of storage, so it's a price they're willing to pay.


Yes, they could get long in theory. In practice, in the place I'm currently using this method, the strings are 3 characters max.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: