Re: SELECT SPEEDS......
On Wed, Aug 20, 2003 at 03:08:59PM -0500, Tom O'Neill (MySQL User) wrote: > Is there any difference in speed between the following select statements? > > SELECT yada,yda FROM test WHERE id IN(1,2,3) > > OR > > SELECT yada,yda FROM test WHERE (id =1 or id = 2 or id =3) Often times, no. But it's best to bencmkark in your environment to be sure. -- Jeremy D. Zawodny | Perl, Web, MySQL, Linux Magazine, Yahoo! <[EMAIL PROTECTED]> | http://jeremy.zawodny.com/ MySQL 4.0.13: up 19 days, processed 958,389,289 queries (566/sec. avg) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: SELECT SPEEDS......
it doesnt work i tried it, case of follow the sheep :D > Paul DuBois [mailto:[EMAIL PROTECTED] writes: > >> At 15:18 -0700 8/20/03, Michael S. Fischer wrote: >> >This is trivial to benchmark yourself. Try: >> > >> >BENCHMARK(10, SELECT yada, yada FROM test WHERE id IN(1,2,3)) >> > >> >And compare to >> > >> >BENCHMARK(10, SELECT yada,yda FROM test WHERE (id =1 or >> id = 2 or >> >id >> >=3)) >> > >> >See http://www.mysql.com/doc/en/Miscellaneous_functions.html for >> >documentation on the BENCHMARK command. >> >> BENCHMARK() is a function, not a command. The syntax you >> suggest will not work. It expects an expression as the >> second argument, not a SELECT statement. >> >> That's my understanding, anyway. If you've been able to make >> that work, I'd be interested to see how you did it. > > I stand corrected. > > --Michael > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: > http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: SELECT SPEEDS......
Paul DuBois [mailto:[EMAIL PROTECTED] writes: > At 15:18 -0700 8/20/03, Michael S. Fischer wrote: > >This is trivial to benchmark yourself. Try: > > > >BENCHMARK(10, SELECT yada, yada FROM test WHERE id IN(1,2,3)) > > > >And compare to > > > >BENCHMARK(10, SELECT yada,yda FROM test WHERE (id =1 or > id = 2 or > >id > >=3)) > > > >See http://www.mysql.com/doc/en/Miscellaneous_functions.html for > >documentation on the BENCHMARK command. > > BENCHMARK() is a function, not a command. The syntax you > suggest will not work. It expects an expression as the > second argument, not a SELECT statement. > > That's my understanding, anyway. If you've been able to make > that work, I'd be interested to see how you did it. I stand corrected. --Michael -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: SELECT SPEEDS......
At 15:18 -0700 8/20/03, Michael S. Fischer wrote: This is trivial to benchmark yourself. Try: BENCHMARK(10, SELECT yada, yada FROM test WHERE id IN(1,2,3)) And compare to BENCHMARK(10, SELECT yada,yda FROM test WHERE (id =1 or id = 2 or id =3)) See http://www.mysql.com/doc/en/Miscellaneous_functions.html for documentation on the BENCHMARK command. BENCHMARK() is a function, not a command. The syntax you suggest will not work. It expects an expression as the second argument, not a SELECT statement. That's my understanding, anyway. If you've been able to make that work, I'd be interested to see how you did it. --Michael -Original Message- From: Tom O'Neill (MySQL User) [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 20, 2003 1:09 PM To: [EMAIL PROTECTED] Subject: SELECT SPEEDS.. Is there any difference in speed between the following select statements? SELECT yada,yda FROM test WHERE id IN(1,2,3) OR > SELECT yada,yda FROM test WHERE (id =1 or id = 2 or id =3) -- Paul DuBois, Senior Technical Writer Madison, Wisconsin, USA MySQL AB, www.mysql.com Are you MySQL certified? http://www.mysql.com/certification/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: SELECT SPEEDS......
This is trivial to benchmark yourself. Try: BENCHMARK(10, SELECT yada, yada FROM test WHERE id IN(1,2,3)) And compare to BENCHMARK(10, SELECT yada,yda FROM test WHERE (id =1 or id = 2 or id =3)) See http://www.mysql.com/doc/en/Miscellaneous_functions.html for documentation on the BENCHMARK command. --Michael > -Original Message- > From: Tom O'Neill (MySQL User) [mailto:[EMAIL PROTECTED] > Sent: Wednesday, August 20, 2003 1:09 PM > To: [EMAIL PROTECTED] > Subject: SELECT SPEEDS.. > > > Is there any difference in speed between the following select > statements? > > SELECT yada,yda FROM test WHERE id IN(1,2,3) > > OR > > SELECT yada,yda FROM test WHERE (id =1 or id = 2 or id =3) > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: SELECT SPEEDS......
On 20 Aug 2003 at 15:08, Tom O'Neill (MySQL User) wrote: > Is there any difference in speed between the following select > statements? > > SELECT yada,yda FROM test WHERE id IN(1,2,3) > > OR > > SELECT yada,yda FROM test WHERE (id =1 or id = 2 or id =3) You can put EXPLAIN in front of your SELECT statement to see how MySQL plans to execute it. Those seem to be treated identically in version 4.0.14, but it's possible that the second one wasn't as optimized in some earlier version. Documentation on EXPLAIN is here: http://www.mysql.com/doc/en/EXPLAIN.html -- Keith C. Ivey <[EMAIL PROTECTED]> Tobacco Documents Online http://tobaccodocuments.org -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]