Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jacobson's avatar

Decimal lat lon vs Geo spatial mysql

Hello, I'm working on a project that collects Lat Lon from mobile devices. Currently I've made it using decimal fields and calculating distance between points on php side (everything works just fine). Is it better to use 'point' field within mysql instead ? What about performance of calculating distances on mysql side using Geo spatial function?

0 likes
3 replies
Cronix's avatar

Yes, use the geospatial functions. It's a lot faster using the highly optimized DB engine to do calculations than using php.

2 likes
willvincent's avatar

I'd go a step further and say use postgres with the postgis extension vs mysql. It's far more mature and a ton of development effort each release is focused solely on performance.

jacobson's avatar

Thank you for a hint, I want to make an mvp and than move to cloud (maybe some queue driver)

Please or to participate in this conversation.