Results within radius - Optimising slow MySQL query

后端 未结 2 1419
温柔的废话
温柔的废话 2020-12-22 09:38
SELECT property.paon, property.saon, property.street, property.postcode, property.lastSalePrice, property.lastTransferDate,
 epc.ADDRESS1, epc.POSTCODE, epc.TOTAL_FL         


        
2条回答
  •  遥遥无期
    2020-12-22 10:10

    You can do a few things:

    • Create a new column so you don't need to use CONCAT CONCAT(property.paon, ', ', property.street) in the GROUP BY and the JOIN (this will speed it up a lot!)
    • As JackHacks says you need to create indexes at the right spot. (property postcode and the newly created column, and epc postcode and address)
    • Remove the HAVING with epc.TOTAL_FLOOR_AREA > 0 and add it to the WHERE

    If you need more help, share en EXPLAIN of your query with us.

提交回复
热议问题