From: Ben Clewett Date: May 14 2008 12:44pm Subject: Re: Query execution time - MySQL List-Archive: http://lists.mysql.com/mysql/212796 Message-Id: <482ADEA6.5030200@clewett.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi Neil, If your using Linux then you have to install the glib RPM's in the usual way. I don't know about other platforms, but I am sure there will be a version of glib out there... Also ensure the correct include and link directives are in your Makefile, which you can get (on Linux) using the commands: # glib-config --cflags # glib-config --libs Ben Neil Tompkins wrote: > Thanks Ben, but I don't appear to have the header file in my > libraries. > > Neil > > > ------------------------------------------------------------------------ > > > Date: Wed, 14 May 2008 12:39:09 +0100 > > From: ben@stripped > > To: neildtompkins@stripped > > CC: craig.huffstetler@stripped; mysql@stripped > > Subject: Re: Query execution time - MySQL > > > > If you using C++ then you can use this: > > > > http://developer.gimp.org/api/2.0/glib/glib-Timers.html > > > > I use this in my code, does an excelent job. > > > > Also you may want to look at the 'slow log' in mysql which will show, to > > the nearest second, the length of queries.... > > > > Ben > > > > Neil Tompkins wrote: > > > Hi Craig, > > > > > > Thanks for your detailed reply. Basically what I'm trying to > extract is the time taken from when I execute the mysql query in my C++ > Builder program until the time the query has finished. > > > > > > So my question is can I build in to my SQL query SELECT Name FROM > Customers the time the query actually took or do I need to do this > outside of my query. > > > > > > Regards > > > Neil > > > > > > > > > Date: Wed, 14 May 2008 07:21:04 -0400From: > craig.huffstetler@stripped: mysql@stripped: Re: Query > execution time - MySQLCC: neildtompkins@stripped Niel,Not > much detail there (but I'll go off what you provided...). Some people > limit the actual MySQL system for times it TAKES MySQL to execute > queries. For THIS to be accomplished, MySQL has built-in functionality > to measure the time is takes queries to take place so it can ... limit > them. So, in essence, I guess we can extract that data and get it back > to you for whatever usage statistic you are looking to measure. ( See: > http://www.bigresource.com/MYSQL-what-is-execution-time-of-a-query-based-on-was-a-mysql-question--0PxW0B3P.html > ) or for usage in JDBC by calling the setQueryTimeout() function of a > Statement object...and so forth.HOWEVER - Just so you know, if you > execute the query MANUALLY via the command-line of MySQL it will tell > you how long the query took. Just use normal SQL syntax, execute > > the query on the table and VOILA! Your answer:mysql queryormysqlrun > the query (use the below quoted/threaded example as a starting place to > write your own query...?)Take a look at this thread (it basically > explains the answer with a bit more detail on what the output will > be):http://forums.mysql.com/read.php?108,51989,142404#msg-142404 > > > SELECT * FROM user_log; 15113 rows fetched in 5.3274s (0.1498s) > SELECT BENCHMARK(100000000, RAND()); 1 row fetched in 0.0505s (13.2676s) > I believe the results are the following: The first number is the time it > took MySQL server to send the result set to the client. The second > number (in parens) is the time it took MySQL server to execute the query > itself. > > > TOTAL TIME will EQUAL A + B (for total time it took on your > server/P.C. or wherever you are running the query...). Many things come > into factoring why it takes longer or shorter. So this is why I asked if > you are attempting to optimize or what not, but that is whole new story. > (( ----> What Operating System are you running? This would be helpful to > give you the step-by-step, so to speak. Or perhaps provide us with a bit > more information***Also, if you are looking to perhaps make it so > queries take shorter times (optimization effort) to execute a little bit > more about your MySQL database setup and machine(s) would be beneficial > to us as well. ))Let me know if you have any questions.Standing by and I > hope this helped you.Sincerely,Craig Huffstetlerxq on FreeNode #mysql | > #apache > > > On Wed, May 14, 2008 at 6:13 AM, Neil Tompkins > wrote: > > > Hi,When performing a SQL query like SELECT Name FROM Customers. How > do I obtain the time in which the query took to execute like 1.5 seconds > etcThanks,Neil_________________________________________________________________All > new Live Search at > Live.comhttp://clk.atdmt.com/UKM/go/msnnkmgl0010000006ukm/direct/01/ > > > _________________________________________________________________ > > > Great deals on almost anything at eBay.co.uk. Search, bid, find and > win on eBay today! > > > http://clk.atdmt.com/UKM/go/msnnkmgl0010000004ukm/direct/01/ > > > > -- > > MySQL General Mailing List > > For list archives: http://lists.mysql.com/mysql > > To unsubscribe: > http://lists.mysql.com/mysql?unsub=neildtompkins@stripped > > > > > ------------------------------------------------------------------------ > Miss your Messenger buddies when on-the-go? Get Messenger on your > Mobile!