RE: Subquery taking too much time on 5.5.18?

2012-07-16 Thread Rick James
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-

RE: Subquery taking too much time on 5.5.18?

2012-07-16 Thread Rick James
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

Re: Subquery taking too much time on 5.5.18?

2012-07-08 Thread Cabbar Duzayak
mysql> SELECT @@optimizer_switch; ++ | @@optimizer_switch | +

Re: Subquery taking too much time on 5.5.18?

2012-07-07 Thread Peter Brawley
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

Re: Subquery taking too much time on 5.5.18?

2012-07-07 Thread Cabbar Duzayak
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

Re: Subquery taking too much time on 5.5.18?

2012-07-06 Thread Rik Wasmus
> 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

Re: Subquery taking too much time on 5.5.18?

2012-07-06 Thread Peter Brawley
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.

RE: Subquery taking too much time on 5.5.18?

2012-07-06 Thread David Lerer
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

Re: Subquery taking too much time on 5.5.18?

2012-07-06 Thread Cabbar Duzayak
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

RE: Subquery taking too much time on 5.5.18?

2012-07-06 Thread Stillman, Benjamin
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.

Re: Subquery taking too much time on 5.5.18?

2012-07-06 Thread Reindl Harald
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