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.

Go Back  dBforums > Database Server Software > MySQL > performance

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-01-07, 09:24
ankur02018 ankur02018 is offline
Registered User
 
Join Date: Jun 2007
Posts: 130
Smile performance

how we can test the performane of any select query in mysql

as wel as increase the performance what we have to do
Reply With Quote
  #2 (permalink)  
Old 10-01-07, 09:57
r937 r937 is offline
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
__________________
r937.com | rudy.ca

pre-order my book Simply SQL from Amazon
Reply With Quote
  #3 (permalink)  
Old 10-01-07, 10:58
ankur02018 ankur02018 is offline
Registered User
 
Join Date: Jun 2007
Posts: 130
Smile

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.
Reply With Quote
  #4 (permalink)  
Old 10-02-07, 05:39
aschk aschk is offline
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.
Reply With Quote
  #5 (permalink)  
Old 10-03-07, 01:22
ankur02018 ankur02018 is offline
Registered User
 
Join Date: Jun 2007
Posts: 130
Smile

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
Reply With Quote
  #6 (permalink)  
Old 10-03-07, 11:24
Pat Phelan Pat Phelan is offline
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
Reply With Quote
  #7 (permalink)  
Old 10-04-07, 03:08
ankur02018 ankur02018 is offline
Registered User
 
Join Date: Jun 2007
Posts: 130
Smile

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
Reply With Quote
  #8 (permalink)  
Old 10-04-07, 09:19
Pat Phelan Pat Phelan is offline
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
Reply With Quote
  #9 (permalink)  
Old 10-04-07, 10:09
ankur02018 ankur02018 is offline
Registered User
 
Join Date: Jun 2007
Posts: 130
Smile

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
Reply With Quote
  #10 (permalink)  
Old 10-04-07, 10:19
aschk aschk is offline
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...
Reply With Quote
  #11 (permalink)  
Old 10-04-07, 10:31
Pat Phelan Pat Phelan is offline
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
Reply With Quote
  #12 (permalink)  
Old 10-04-07, 10:45
shammat shammat is offline
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On