OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: mysql is dead slow

From: Rob Wultsch (wultschgmail.com)
Date: Mon Oct 20 2008 - 19:06:07 CDT


1, Subqueries should be avoid when using mysql. Rewriting to be using joins
will probably solve your problem.
2. Explain is your friend.

On Mon, Oct 20, 2008 at 4:38 PM, Sangeetha <ysndargmail.com> wrote:

> Hi,
> Is something wrong with a sql query like this?
> (SELECT commentname, count(comments.ID) as comid, 'comments' as section
> from
> comments where commentname IN (SELECT DISTINCT commentname from comments
> where id=35037 ORDER BY commentname)Group by commentname) UNION ALL (SELECT
> Username, count(ID), 'questions' from questions where Username IN (SELECT
> DISTINCT commentname from comments where id=35037 ORDER BY
> commentname)Group
> by Username)
> It is dead slow... almost doesnt work.. is it the query or is my DB set up
> wrong? When i had records of around 500 rows it worked fine.. now i have
> around 60000 rows its dead slow....Please help me...
>

--
Rob Wultsch