From: Reindl Harald Date: April 20 2012 7:50am Subject: Re: Why does the limit use the early row lookup. List-Archive: http://lists.mysql.com/mysql/227213 Message-Id: <4F91152B.7000001@thelounge.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig1188505575AE297BA5EA427D" --------------enig1188505575AE297BA5EA427D Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: quoted-printable Am 20.04.2012 04:29, schrieb =D5=C5=D6=BE=B8=D5: > My point is that the limit can use late row lookup: lookup rows after > checking indexes to optimize the select speed. >=20 > But the mysql optimizer do it with the early row lookup: lookup all row= s > before checking indexes when the one fetch column is not in the indexes= =2E >=20 > Tell me why? because the mysql optimizer until now is really bad in many situations - order by rand() makes a temporary table wil ALL data as example even with limit select * from table order by rand() limit 10; reads and writes the whole table to disk have fun with large tables :-) --------------enig1188505575AE297BA5EA427D Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk+RFSsACgkQhmBjz394AnnGgQCcCWYhOTnJSS1f8y2a7aJPKebz hmMAoJRLgbTRI0nwbI6zytVFvxAMrPQp =yEhQ -----END PGP SIGNATURE----- --------------enig1188505575AE297BA5EA427D--