How can I show the query time in Perl, DBI?

后端 未结 4 1361
梦谈多话
梦谈多话 2021-01-05 03:57

I use Perl and DBI to manage my MySQL tables, querys, etc. How can I show the running time of a query?

If I do a SELECT in the console, the result will be like this:

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-05 04:46

    You take a timestamp before you run the query, and a timestamp after. The difference is your query execution time. For obtaining high-resolution timestamps, see Time::HiRes

提交回复
热议问题