do sort by sql. optimize query by preloading.