Showing posts with label query execution time. Show all posts
Showing posts with label query execution time. Show all posts

Wednesday, March 23, 2011

Get query execution time in PHP

Hi,

When you perform a Google search, it shows the approximate number of records and the time taken to make that search. e.g.


For a layman, that time may seem to be the time taken for the entire process. But actually its the time taken to generate the search results. So technically, its the time taken to execute the search query. I have used the following technique to do the same. But I am sure that can be many more ways to achieve it.

For this I created a simple table just for demonstration as follows:


Now my objective is to run a query on this table and fetch the time required to run that query using PHP. So this is the code that I have written: