Unix Technical Forum

Is there query optimizer tool for MySQL?

This is a discussion on Is there query optimizer tool for MySQL? within the MySQL forums, part of the Database Server Software category; --> I want to optimize my query. Is there such tool available for MySQL? Thanks, Here is a sample query: ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 10:29 AM
Steveston
 
Posts: n/a
Default Is there query optimizer tool for MySQL?

I want to optimize my query. Is there such tool available for MySQL?

Thanks,

Here is a sample query:

select id, username, role, first_name,last_name,email from users where
id in
(select distinct user_id from user_enrols where course_id in
(select distinct course_id from user_courses where user_id=2) and
role='S' and username like '%1%')

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 10:29 AM
Jerry Stuckle
 
Posts: n/a
Default Re: Is there query optimizer tool for MySQL?

Steveston wrote:
> I want to optimize my query. Is there such tool available for MySQL?
>
> Thanks,
>
> Here is a sample query:
>
> select id, username, role, first_name,last_name,email from users where
> id in
> (select distinct user_id from user_enrols where course_id in
> (select distinct course_id from user_courses where user_id=2) and
> role='S' and username like '%1%')
>
>


EXPLAIN.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 10:29 AM
ZeldorBlat
 
Posts: n/a
Default Re: Is there query optimizer tool for MySQL?

On Nov 7, 6:14 pm, Steveston <minghu...@gmail.com> wrote:
> I want to optimize my query. Is there such tool available for MySQL?
>
> Thanks,
>
> Here is a sample query:
>
> select id, username, role, first_name,last_name,email from users where
> id in
> (select distinct user_id from user_enrols where course_id in
> (select distinct course_id from user_courses where user_id=2) and
> role='S' and username like '%1%')


Yeah -- there's no point in using "distinct" inside those sub-
queries. That's one reason to use an "in" clause in the first place.
Having said that, if you don't have a specific reason for using the
"in" clause use a join instead.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-28-2008, 10:29 AM
Captain Paralytic
 
Posts: n/a
Default Re: Is there query optimizer tool for MySQL?

On 7 Nov, 23:14, Steveston <minghu...@gmail.com> wrote:
> I want to optimize my query. Is there such tool available for MySQL?
>
> Thanks,
>
> Here is a sample query:
>
> select id, username, role, first_name,last_name,email from users where
> id in
> (select distinct user_id from user_enrols where course_id in
> (select distinct course_id from user_courses where user_id=2) and
> role='S' and username like '%1%')


JOINS?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:05 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com