In the last episode (May 20), Axel Rauschmayer said:
> mysql Ver 9.38 Distrib 3.22.32, for pc-linux-gnu (i686):
> LIMIT skips records when used on a fairly complex table together with a
> where condition.
> The following two queries produce different results for even the first
> 3000 records (with limit, some item_ids are missing):
> SELECT item_id WHERE changed > 315529200000 limit 4000;
> SELECT item_id WHERE changed > 315529200000;
I bet the first query is using an index on "changed", where the second
is doing a full table scan. What does an EXPLAIN on both queries say?
Since you don't have an "order by" clause in either query, mysql is
free to return records in any order. If the records were not inserted
sorted by "changed", then an index scan and a full table scan would
return them in a different order.