native query for HistoricVariableInstance and HistoricDetail