Plan history query tweak