3 ms·
This is an interesting article about strategies to use when traditional indexes just won't do, but for the love of the index please use MySQL's (or postgres' or
by nwallin 5y ago
This is an interesting article about strategies to use when traditional indexes just won't do, but for the love of the index please use MySQL's (or postgres' or sqlite's) built in spatial index for this particular class of problems. It will does this sort of thing much, much more efficiently than 99% of in house solutions.
https://dev.mysql.com/doc/refman/8.0/en/spatial-types.html https://dev.mysql.com/doc/refman/8.0/en/spatial-types.html
http://postgis.refractions.net/ http://postgis.refractions.net/
https://sqlite.org/rtree.html https://sqlite.org/rtree.html
- IdontRememberIt 5y agoWith mysql 5.7, range searches on indexes (BETWEEN() or equivalent) are notoriously slow with large datasets. We discovered that spacial index (flatten to 1 dimension) can be used to solve a common issue: ip range queries. The query costs dropped and all the query metrics improved.
- hu3 5y agoDoes it improve in newer versions of MySQL? I'll need to so similar work soon.