Results 1 to 22 of 22
Apr 8, 2014, 12:23 #1
- Join Date
- Jul 2007
- 0 Post(s)
- 0 Thread(s)
Help: "not equals !=" is very slow
I have a script where I would like to show 5 random items from a particular seller, and 5 random items from other sellers:
$sql = "SELECT * FROM items WHERE seller = 'johndoe' LIMIT 5";
$sql = "SELECT * FROM items WHERE seller != 'johndoe' LIMIT 5";
The first query runs through super quick (0.01 seconds).
The second query takes 10 seconds.
I see that the Not Equals or "!=" does not work on an index. Is there a way to speed this up somehow?