Record query history