Jump to content


Photo

SubQuery seems to hang MySQL


  • Please log in to reply
1 reply to this topic

#1 redRemedy

redRemedy
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 13 September 2006 - 02:43 PM

Hi!

I am currently evaluating MySQL version 4.1.21. Until now I have only used versions without the support of SubQueries.

As my first test I was planning to re-make som existing queries into Sub-queries. So I started with the following query:
SELECT p.*
FROM
s24_event e, s24_event_participant ep, s24_participant p
WHERE
ep.event = $pEventId
AND e.id = ep.event
AND p.id = ep.participant

and I changed it into this:
SELECT *
FROM s24_participant
WHERE id IN
(
SELECT participant
FROM `s24_event_participant`
WHERE event = $pEventId
)


I should get the same result from these two queries, right?

The latter one seems to cayse MySQL to stop responding. WHen I ran it through a PHP-script I got the "Too many connections"-error message.

Does anyone have any ideas of what the problem could be?

// Jonas Eriksson


#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 13 September 2006 - 03:20 PM

Not really sure, though you really should leave it as a join.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users