Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PostgreSQL PostGIS vs ElasticSearch Spatial search

I am working on a search query which needs to do a geospatial filter (i.e. filter all elements outside of a certain radius). We have both PostgreSQL and ElasticSearch as part of our infrastructure and I am evaluating which of the two to use.

I'm not asking for "which is better", but an objective pros & cons list would be helpful, in terms of ease of implementation, performance, scalability, etc.

like image 776
lmirosevic Avatar asked Apr 18 '14 11:04

lmirosevic


1 Answers

The postgis scales the same way as postgresql scales. The postgis index will work pretty the same as other relational, you may check it out here.

If you take a look at the link, it explains that it indexes using some geometrical algorithm which is performed on each insert operation, so it might not be responsive enough in real-time apps.

While elasticsearch have real time indexing, based on Lucene index. Elastic search generally suits better for realtime heavy applications, then Postgresql.

Postgresql has a huge advantage it is simplicity. It is much easier to implement test and maintain such a feature using Postgresql. For example, I prefer creating prototype based on Postgresql quickly, and if it starts perform bad because of big amount of writes, etc. I switch to elasticsearch implementation.

like image 85
Slow Harry Avatar answered Sep 25 '22 01:09

Slow Harry