Tests in order to know if a query is taking too long to respond?

How could I built a test in order to know when my query is taking longer period than 30 seconds to execute ?
It doesn’t have to be a test, but I need to know when it goes for a longer period of time.
I have built up a circle_test and I have replicated the data from the production in it.