Skip to main content
Formatted code (use CTRL-K or the {} edit toolbar icon); incorporated comment
Source Link
Paul White
  • 90.3k
  • 30
  • 424
  • 663

I would rewrite your query in the following manner:

SELECT *  
FROM stuff FORCE INDEX(indexedColumn)
WHERE 
    (
        Latitude > '29.187190582784076' 
        AND Latitude < '29.761053992852936'
    ) 
    AND 
    (
        Longitude > '-101.0597705588786' 
        AND Longitude < '-99.7414111838786') 
 ORDER BY FORCE INDEX(indexedColumn) 
ORDER BY DESC LIMIT 100;

Try the FORCE INDEX option and also try the nested greater than and less than and more verbose query instead of between and check the results.

I would rewrite your query in the following manner:

SELECT * FROM stuff WHERE (Latitude > '29.187190582784076' AND Latitude < '29.761053992852936') AND (Longitude > '-101.0597705588786' AND Longitude < '-99.7414111838786') ORDER BY FORCE INDEX(indexedColumn) DESC LIMIT 100;

Try the FORCE INDEX option and also try the nested greater than and less than and more verbose query instead of between and check the results.

I would rewrite your query in the following manner:

SELECT *  
FROM stuff FORCE INDEX(indexedColumn)
WHERE 
    (
        Latitude > '29.187190582784076' 
        AND Latitude < '29.761053992852936'
    ) 
    AND 
    (
        Longitude > '-101.0597705588786' 
        AND Longitude < '-99.7414111838786' 
    ) 
ORDER BY DESC LIMIT 100;

Try the FORCE INDEX option and also try the nested greater than and less than and more verbose query instead of between and check the results.

Source Link

I would rewrite your query in the following manner:

SELECT * FROM stuff WHERE (Latitude > '29.187190582784076' AND Latitude < '29.761053992852936') AND (Longitude > '-101.0597705588786' AND Longitude < '-99.7414111838786') ORDER BY FORCE INDEX(indexedColumn) DESC LIMIT 100;

Try the FORCE INDEX option and also try the nested greater than and less than and more verbose query instead of between and check the results.