Subject Re: ORDER BY on large VARCHAR columns
Author robert_difalco
> have you tried adding another field of say 128 characters (I don't
know your
> collation), on insert/update put the leading substring in this
field and
> have this field indexed so you use it to return the order you want?
> Alan

Problem is that the string would be too short to be valuable in an
ORDER BY. Consider that this field is something like a qualified
file system path. The front part could be repeated in many of the
rows but you need both the front and the back (and even the middle)
for ordering them accurately. I think the best approach is to
calculate the order as they are inserted, just would be nice to have
an example of how best to do that.