optimize sqlstring for posts