In the last episode (Jun 19), Mark Hazen said:
> I am using MySQL 3.23.51 on Linux. I have a fixed-length table with 45
> million rows. It appears MySQL has an efficiency issue with the LIMIT
> command. When I run SELECT a FROM b LIMIT 0, 1000000 <-- that's one
> The query finishes almost immediately.
> But when I run 20 million rows into the dataset, it really slows down.
> (pretend the commas aren't there)
> SELECT a FROM b LIMIT 20,000,000, 1,000,000
> Why would it slow down? We're dealing with a fixed-length table here. This
> is just mathematics to figure out where row 20,000,000 is.
Without an ORDER BY, there is no "row 20,000,000". SQL results are
unordered sets, so mysql has to walk through 20M records before it can
hand you the 1M you want. Ordering by your primary key should make it
a lot faster, as mysql should be able to do an index walk to quickly
find the correct starting point.