List:General Discussion« Previous MessageNext Message »
From:James Black Date:May 17 2005 3:33pm
Subject:re: using OR seems faster than using IN
View as plain text  
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have a query where I am fetching, in my test 68, rows.  Using OR was
faster by about 1.5 times, than the same query using IN.  Should this be
expected, using mysql 5.0.4, on Solaris 8, java 1.5.

SELECT name, id FROM table WHERE idx=? OR idx=? OR idx=? ...

SELECT name, id FROM table WHERE idx IN(?,?,?)

I am also using prepared statements, obviously, and looping through my
function 100 times, to get a better idea as to speed, and using junit
for the testing.

- --
"Love is mutual self-giving that ends in self-recovery." Fulton Sheen
James Black    james@stripped
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCig6sikQgpVn8xrARAuBzAJ44tfBLXpYelSd0bTu6GDqjnvJEbgCcDAh4
pOr6+PhSZ7YEXKqCZPtKPzU=
=zo9u
-----END PGP SIGNATURE-----
Thread
re: using OR seems faster than using INJames Black17 May
  • why does this query work??!!!nngau17 May
    • Re: why does this query work??!!!mfatene17 May
    • Re: why does this query work??!!!Michael Stassen17 May
    • Re: why does this query work??!!!Peter Brawley17 May
      • RE: why does this query work??!!! - THANKS!!!nngau17 May