What is the ideal data type to use when storing latitude / longitude in a MySQL database?

前端 未结 21 2913
梦如初夏
梦如初夏 2020-11-22 09:40

Bearing in mind that I\'ll be performing calculations on lat / long pairs, what datatype is best suited for use with a MySQL database?

21条回答
  •  鱼传尺愫
    2020-11-22 09:56

    depending on you application, i suggest using FLOAT(9,6)

    spatial keys will give you more features, but in by production benchmarks the floats are much faster than the spatial keys. (0,01 VS 0,001 in AVG)

提交回复
热议问题