declare time elapsed function
compute the query time