MySQL Forums
Forum List  »  Optimizer & Parser

Re: query optimisation
Posted by: Rick James
Date: February 11, 2010 10:46PM

See what you get from this:
( SELECT  m.*
    FROM  Matches m, TippingCompetitions c
    WHERE  m.competitionname = c.name
      AND  now() + INTERVAL 10 DAY > dateplayed
      AND  dateplayed > now() - interval c.matchtime MINUTE
)
UNION DISTINCT
( SELECT  m.*
    FROM  Matches m, TippingCompetitions c
    WHERE  m.competitionname = c.name
      AND  round = c.nextround
      AND  dateplayed > now() - interval c.matchtime MINUTE
)
ORDER BY  competitionname, dateplayed, division;

If that does not help, please provide
* SHOW CREATE TABLE tbl\G -- engine, indexes
* SHOW TABLE STATUS LIKE 'tbl'\G -- sizes
* EXPLAIN SELECT ...\G -- clues of inefficiencies
* SHOW VARIABLES LIKE '%buffer%'; -- cache size
and surround them with [ code ] and [ / code ]

Options: ReplyQuote


Subject
Views
Written By
Posted
2325
February 10, 2010 08:08AM
Re: query optimisation
1480
February 11, 2010 10:46PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.