add history query