How fast does this run?
SELECT A.*
FROM A
JOIN B ON B.A_ID = A.id
WHERE B.name LIKE 'X%';
Turning a subquery into a JOIN usually improves performance. (The main
exception is when the subquery consolidates data via GROUP BY, DISTINCT, LIMIT,
etc.)
> -Original Message-
To: mysql@lists.mysql.com
> Subject: Re: Subquery taking too much time on 5.5.18?
>
>
>
> Am 06.07.2012 17:46, schrieb Cabbar Duzayak:
> > Hi Everyone,
> >
> > I have been trying to understand why subqueries are taking tooo much
> > time on my installation of MySQL
mysql> SELECT @@optimizer_switch;
++
| @@optimizer_switch
|
+
On 2012-07-07 9:52 AM, Cabbar Duzayak wrote:
Hmm,
Looking at the link http://www.artfulsoftware.com/infotree/queries.php
and explanations here, EXISTS() should have performed better, but does
not seem to??? I stopped it after about 5 minutes.
I tried both:
SELECT * FROM A WHERE EXISTS (SELE
Hmm,
Looking at the link http://www.artfulsoftware.com/infotree/queries.php
and explanations here, EXISTS() should have performed better, but does
not seem to??? I stopped it after about 5 minutes.
I tried both:
SELECT * FROM A WHERE EXISTS (SELECT * FROM B WHERE A.id=B.A_ID and
B.name like 'X
> See "The unbearable slowness of IN()" at
> http://www.artfulsoftware.com/infotree/queries.php
Do you read your own links? Excerpt:
> In 5.0, EXISTS() is much faster than IN(), but slower than JOIN. In 5.5,
EXISTS() performs about as well as JOIN.
So judging by the subject line...
--
My
On 2012-07-06 5:07 PM, David Lerer wrote:
Cabbar, try to replace the IN subquery with an EXISTS. Something like:
SELECT * FROM A WHERE EXISTS (SELECT * FROM B WHERE A.id=B.A_ID and B.name
like 'X%');
See "The unbearable slowness of IN()" at
http://www.artfulsoftware.com/infotree/queries.
Cabbar, try to replace the IN subquery with an EXISTS. Something like:
SELECT * FROM A WHERE EXISTS (SELECT * FROM B WHERE A.id=B.A_ID and B.name
like 'X%');
Does it help?
David.
-Original Message-
From: Cabbar Duzayak [mailto:cab...@gmail.com]
Sent: Friday, July 06, 2012 11:46 AM
T
forcing MySQL to run
> from the inside out. I don't have a running instance nearby to test on, but I
> hope it helps.
>
>
>
>
>
>
> -Original Message-
> From: Reindl Harald [mailto:h.rei...@thelounge.net]
> Sent: Friday, July 06, 2012 11:58 AM
&g
ping the subquery within another subquery, forcing MySQL to run
from the inside out. I don't have a running instance nearby to test on, but I
hope it helps.
-Original Message-
From: Reindl Harald [mailto:h.rei...@thelounge.net]
Sent: Friday, July 06, 2012 11:58 AM
To: mysql@lists.
Am 06.07.2012 17:46, schrieb Cabbar Duzayak:
> Hi Everyone,
>
> I have been trying to understand why subqueries are taking tooo much
> time on my installation of MySQL 5.5.18 on Ubuntu 11.10 release.
>
> In a nutshell, I have 2 tables: A and B. And, I do something like this:
>
> SELECT * FROM
11 matches
Mail list logo