List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:May 20 2000 3:20pm
Subject:Re: "Limit" missing records under MySQL 3.22.32?
View as plain text  
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.

-- 
	Dan Nelson
	dnelson@stripped
Thread
"Limit" missing records under MySQL 3.22.32?Axel Rauschmayer20 May
  • Re: "Limit" missing records under MySQL 3.22.32?Dan Nelson20 May
    • Re: "Limit" missing records under MySQL 3.22.32?Axel Rauschmayer20 May
      • Re: "Limit" missing records under MySQL 3.22.32?Dan Nelson20 May