speed up sql lookups on sort order (really slow!)