Database/SQL: How to store longitude/latitude data?

后端 未结 8 1231
醉酒成梦
醉酒成梦 2020-12-07 10:03

Performance question ...

I have a database of houses that have geolocation data (longitude & latitude).

What I want to do is find the best way to store t

8条回答
  •  既然无缘
    2020-12-07 10:36

    I have the exact same schema (float(10,6)) and query (selecting inside a rectangle) and I found that switching the db engine from innoDB to myisam doubled the speed for a "point in rectangle look-up" in a table with 780,000 records.

    Additionally, I converted all lng/lat values to cartesian integers (x,y) and created a two-column index on the x,y and my speed went from ~27 ms to 1.3 ms for the same look-up.

提交回复
热议问题