sort metadata tables by key value