After I updated MySQL from 5.7 to 8, spatial functions have become very slow. Specifically, this query:
SELECT points3_.track_id AS track_id
FROM waypoint points3_
WHERE ST_CONTAINS(ST_POLYFROMTEXT('POLYGON ((34.82041 32.041814, 34.82041 32.158149, 35.47959 32.158149, 35.47959 32.041814, 34.82041 32.041814))'), points3_.point)
now uses a full table scan and takes 6 seconds on 500,000 records, while before it took milliseconds.
I have a spatial index on point
column, but it's not activated even if I enter force index (point)