sort by weight to shrink table to threshold size