Repository navigation
PostGIS vs Apache Sedona for a real-time, multi-city routing app — justified or overkill at this scale? #3575
Replies: 1 comment
|
Your read is right: at this scale Sedona is overkill, and PostGIS is the better fit. Why PostGIS fits your workload. You have a real-time, read-mostly workload with frequent small writes and low-latency proximity lookups. That's exactly what a transactional database with a GiST index is built for. Even at 20 cities, you're at a few thousand sensors and refuge points plus a growing time series, which is small for PostGIS. Sedona's engines (Spark, Flink) are built for throughput, not latency. Starting a job to answer "nearest cool centre within 500 m" would add seconds of overhead to a query PostGIS answers in milliseconds, and you'd be running a cluster for no benefit. A few PostGIS tips for this workload:
When Sedona starts to pay off. Roughly when the data or the job no longer fits comfortably on one machine. That means billions of points (full GPS trace archives, all-city mobility data), multi-TB vector or raster datasets, or large spatial joins in batch analytics where you care about throughput, not response time. Sedona also makes sense if you already have a Spark or Flink lakehouse and want spatial SQL inside it. A few cities' worth of live sensor data is orders of magnitude below that. Migration path and hybrid setups. Yes, the hybrid you describe is the common pattern:
Since both use the same So: keep PostGIS, tune it as above, and add Sedona only when a batch-analytics need shows up that a single Postgres box can't handle. |
Uh oh!
There was an error while loading. Please reload this page.
Context
I'm building a heat-aware ("cool") pedestrian routing app. The idea: encode "hot street → slow street" so a routing engine's fastest-path search returns the coolest path. Every ~10 minutes a background worker reads live air temperatures (per-city value + a set of point sensors), interpolates a temperature per street (inverse-distance weighting), converts it to a walking speed, and feeds per-city speed files to the routing engine. It's designed for multiple cities from the start (currently 2, targeting ~10–20).
The stack is Dockerized: routing engine + Python updater + PostGIS + a small API + web map.
Current data layer (PostGIS)
PostGIS stores the spatial data and answers the spatial queries:
sensor_readings — point sensors with timestamped temperatures. ~30–80 sensors per city (adjust), a new reading per sensor every ~10 min.
cool_centres — a few dozen refuge points per city.
Typical queries: nearest cool centres within a radius (ST_DWithin / ST_Distance / ST_MakePoint), and latest reading per sensor.
So the workload is real-time, read-mostly, small-to-moderate (thousands of rows per city, not millions), with frequent small updates.
The question
I was also looking at the possibility of using Apache Sedona. From what I understand, Sedona offers the same ST_* functions but is built for distributed, large-scale spatial processing on Spark/Flink — millions+ of geometries on a cluster.
Given my scale (a handful of cities, tens–hundreds of sensors each, real-time 10-minute updates, simple proximity queries):
Is Apache Sedona justified here, or is it overkill vs plain PostGIS?
At roughly what data scale / workload would Sedona start to pay off over PostGIS?
If I later scale to many more cities/sensors, is there a clean migration path, or a hybrid setup people use (e.g. PostGIS for live/transactional, Sedona for large offline/batch analytics)?
Thanks — trying to make an informed architecture decision rather than add Spark just because it's available
All reactions