add some code to calculate how long to get the result in DB