SELECT property.paon,
property.saon,
property.street,
property.propertytype,
property.postcode,
property.lastsaleprice,
Date(property.lasttransferdate),
St_distance_sphere(Point(-1.3429, 54.5924), coords) * 0.000621371192 AS
distance
FROM property property
INNER JOIN epc
ON property.postcode = epc.postcode
AND Concat(property.paon, ', ', property.street) =
epc.address1
WHERE property.lasttransferdate >= CURRENT_DATE() - INTERVAL 10 year
HAVING distance < 0.5
LIMIT 10
当距离小于0.5时,此查询大约需要1.2秒,随着距离的增加,查询速度会加快。但是,低于0.5的速度开始跳到持续时间太长,无法接受用户体验。
距离<0.4-3.4秒
距离<0.3-6.3秒
距离<0.2-10.5秒
距离<0.1-43.8秒
在某些情况下,距离越小,精度就越高,因此对这些较小的距离进行速度优化非常重要。
有用信息
where和join子句中的所有内容都被索引
坐标是一个点,并被索引
暂无答案!
目前还没有任何答案,快来回答吧!