| |
Welcome to the dBforums forums.
You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!
If you have any problems with the registration process or your account login, please contact contact support.
If you prefer not to see double-underlined words and corresponding ads, place your cursor here for ContentLink opt out.
|
 |

10-01-07, 09:24
|
|
Registered User
|
|
Join Date: Jun 2007
Posts: 130
|
|
performance
|
how we can test the performane of any select query in mysql
as wel as increase the performance what we have to do
|
|

10-01-07, 09:57
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 13,556
|
|
you can test performance in two ways:
1. by actually running the query
you might take a clock reading before and after, to get elapsed time
2. by examining the EXPLAIN output
look for things like table scans and temporary tables
there are many ways to increase performance—it is a career, not a task—but the most effective is to declare indexes on join columns, searched columns, and/or sort columns
|
|

10-01-07, 10:58
|
|
Registered User
|
|
Join Date: Jun 2007
Posts: 130
|
|
|
Quote:
|
Originally Posted by r937
you can test performance in two ways:
1. by actually running the query
you might take a clock reading before and after, to get elapsed time
2. by examining the EXPLAIN output
look for things like table scans and temporary tables
there are many ways to increase performance—it is a career, not a task—but the most effective is to declare indexes on join columns, searched columns, and/or sort columns
|
its not easy that you take clock and measure the time taken by query
if there is some command to check the query time taken so please tell
through EXPLAIN statement there is no information about performance
|
Last edited by ankur02018 : 10-01-07 at 11:09.
|

10-02-07, 05:39
|
|
Registered User
|
|
Join Date: Mar 2007
Location: 636f6d7075746572
Posts: 734
|
|
The EXPLAIN statement is ALL about performance, read the documentation if you don't understand the output you're getting http://dev.mysql.com/doc/refman/5.0/en/explain.html
It won't give you a time, but it will tell you what your query is doing to get it's results which should help you identify where the slow parts are going to be.
|
|

10-03-07, 01:22
|
|
Registered User
|
|
Join Date: Jun 2007
Posts: 130
|
|
Quote:
|
Originally Posted by aschk
The EXPLAIN statement is ALL about performance, read the documentation if you don't understand the output you're getting http://dev.mysql.com/doc/refman/5.0/en/explain.html
It won't give you a time, but it will tell you what your query is doing to get it's results which should help you identify where the slow parts are going to be.
|
so is there any command through which we can get time taken by select query
|
|

10-03-07, 11:24
|
|
Resident Curmudgeon
|
|
Join Date: Feb 2004
Location: In front of the computer
Posts: 9,573
|
|
Quote:
|
Originally Posted by ankur02018
so is there any command through which we can get time taken by select query
|
Do you want to know the time taken at the server, or the time taken at the client? If you need to know the time at the client, does it matter whether the client is local or remote (logically near or far from the MySQL server)?
The problem with measuring performance comes in determining what you really want to measure!
-PatP
|
|

10-04-07, 03:08
|
|
Registered User
|
|
Join Date: Jun 2007
Posts: 130
|
|
Quote:
|
Originally Posted by Pat Phelan
Do you want to know the time taken at the server, or the time taken at the client? If you need to know the time at the client, does it matter whether the client is local or remote (logically near or far from the MySQL server)?
The problem with measuring performance comes in determining what you really want to measure!
-PatP
|
if you could tell any command either in server or client throgh which we can get time taken by any select query in secs
|
|

10-04-07, 09:19
|
|
Resident Curmudgeon
|
|
Join Date: Feb 2004
Location: In front of the computer
Posts: 9,573
|
|
The answers at the server and the client will be different, probably significantly different. Which do you want? If you want the answer at the client, which language(s) are you using there?
-PatP
|
|

10-04-07, 10:09
|
|
Registered User
|
|
Join Date: Jun 2007
Posts: 130
|
|
Quote:
|
Originally Posted by Pat Phelan
The answers at the server and the client will be different, probably significantly different. Which do you want? If you want the answer at the client, which language(s) are you using there?
-PatP
|
answer on client
application is on java
i am DBA
using mysql as backhand
|
|

10-04-07, 10:19
|
|
Registered User
|
|
Join Date: Mar 2007
Location: 636f6d7075746572
Posts: 734
|
|
In which case take a timestamp in java before you execute your SQL query and one after et voila, you have your answer...
|
|

10-04-07, 10:31
|
|
Resident Curmudgeon
|
|
Join Date: Feb 2004
Location: In front of the computer
Posts: 9,573
|
|
Quote:
|
Originally Posted by aschk
In which case take a timestamp in java before you execute your SQL query and one after et voila, you have your answer...
|
Yeah, what aschk said!
-PatP
|
|

10-04-07, 10:45
|
|
Registered User
|
|
Join Date: Nov 2003
Posts: 654
|
|
Quote:
|
Originally Posted by ankur02018
application is on java
|
There are several alternatives (not a complete list!):
1) Use P6Spy to log all DBMS activity and their timings
2) (very cumbersome) write your own timing code in the source code
3) (cumbersome) Copy and paste the the SQL statements from the application into a SQL client that displays the execution time of a statement
4) Use a profiler (e.g. the one built into NetBeans http://www.netbeans.org) to profile your application and measure the time for the methods accessing the database
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|