new stats funtions to get waits from database