In this episode, the topic is distributed database systems. The talk covers what distributed databases are, how they work, and why they are important. While this sounds like a technical topic, the show is presented in a way that gives you a soft start to it. And the guest does an amazing job of making the concepts digestible and easy to understand.
About The Guest
Mo Sarwat is an expert in enterprise-scale geospatial systems and an associate professor in computer science at Arizona State University. He is the creator of Apache Sedona, an enterprise-scale geospatial data system. His work focuses on how to build robust software systems that can manage, query, and interact with geospatial data at an enterprise scale.
What Is A Distributed Database?
In a distributed database, data is partitioned or replicated and stored in multiple locations. This differs from centralized databases that store data at one ‘central’ location and have one server that handles all queries on the data. Distributed databases have multiple data centers and multiple servers that are distributed over a network.
A big property of distributed databases is transparency. The details of the distribution are hidden from the user of the system. The applications running on a distributed database would still run the same queries and workload as they would on a centralized database. The only difference is that in a distributed system, the system internally takes that query and distributes its execution based on where the data is after being partitioned.
What Is Parallel Processing In Distributed Databases?
With parallel processing, a task is split into smaller tasks that can be executed independently across multiple servers of a distributed database. Parallelizing the execution of a task across multiple computer nodes results in faster and more efficient execution. Splitting a task into 10 smaller parts that can be solved simultaneously results in a 10 times faster execution. The speed to execute a task increases when more computer nodes are added to the network.
What Is Load Balancing?
In load balancing, every single compute node that is responsible for one partition of a distributed database should do the same amount of work as the others in the network. Ideally, this means that each database that is part of the distributed network should store the same amount of records.
One way to achieve this is by storing the records in a round-robin fashion across the databases. Eventually, each node ends up with the same number of records.
With geospatial data, it is preferable to use a partitioning scheme that takes into account the geospatial distribution of the data. This is beneficial when running geospatial queries because the data that have close spatial proximity will be at the same location and do not need to be pulled from different servers. But the problem with this is that geospatial data is hardly uniform. A small geographical area such as a big city may have a very high concentration of geospatial records compared to a vast desert area. This data skew misbalances the workload because some partitions may end up with a lot of data while others have less data.
In parallel query processing the partition with less data will finish work fast because it does not have so much data to process. When partitioning geospatial records, the method used should take into account this data skew and the proximity as well. Otherwise running parallel queries on the data will result in terrible performance.
What Are The Benefits Of A Distributed Database?
A distributed database system brings several benefits to a network. One of them is ensuring the availability of the system. Let’s take Uber as an example. Uber receives tons of requests per second. If all customer and driver data is stored in one location and served only through a single node, the compute power of such a node may not be able to service all the requests that it receives.
The system may become unavailable because there is only a limited number of requests that a single node can handle per second. But with a distributed database system, the network benefits from a higher compute power to process the requests, which boosts the availability of the system.
Using a distributed database to store data close to where it will be used greatly boosts the performance of a system. For Uber, all the driver and customer data in a city will be stored in the same server because they will be accessed by users in the same city. Since data is close to where it is being used, the system’s performance will be better. Additionally, running batch analytics on the data will benefit from the parallel processing capability of distributed databases. Parallelizing the execution across different nodes can scale the analytics that are run on the data.
What Is Apache Sedona?
Apache Sedona is an open-source project under the Apache Software Foundation. It’s designed to enable scalable and efficient analysis of large datasets and provides tools for working with geospatial data in a distributed computing environment. If you are running spatial SQL queries that do analytics on data stored in a centralized database or a data lake, but you wish to run the analytics at scale in a distributed system, Apache Sedona can help you achieve that. When the data is loaded into Sedona, it will be repartitioned based on the geospatial aspect and enable the analytics to benefit from parallel processing of distributed database systems.
Why Do Enterprises Have A Lot Of Unused Data?
According to a 2022 Gartner report, 97% of data collected in enterprises remains unused. This is quite ironic because there is a notion today that data is the new oil. However, being able to derive value from only 3% of the data does not mean that the other 97% does not have any value. There is still a lot of value that can be derived from the unused data. The big challenge could be that enterprises and organizations do not have the tools to put the data into the right context and derive business value from it.
Similar to oil, which is only beneficial when put in the right context, placing data in the right context would make a big difference. Putting data into the right context by assigning geospatial and temporal aspects to it can open possibilities for deriving business value because you can tell a story about the data.
For so long, the geospatial community has focused on GIS technology. But alongside these efforts, the geospatial community can make a greater impact by helping organizations to put their data into the right context. In that way, there will be less unused data, and more usable and valuable data.
During the conversation, we mention PostgreSQL and PostGIS a few times, which are topics that we have covered in previous podcast episodes.
In Conversation
Enterprise-Scale Geospatial Systems
Daniel: Mo, welcome to the podcast. You’re the creator of Apache Sedona, an associate professor in computer science, and the CEO of Wherobots. Is it fair to say you’re an expert in enterprise-scale geospatial systems?
Mo: I would say so. As an associate professor of computer science at Arizona State University, the main focus of my lab is enterprise-scale geospatial data systems — if you have geospatial data and you want to build robust software systems that can manage, query, and interact with it at enterprise scale, how can you do that? My training is in large-scale data management, big data systems, and data science, with a focus on geospatial and spatial-temporal applications.
What a Distributed Database Is
Daniel: What is a distributed database?
Mo: Let me compare it to a centralized database. A centralized database has one location where the data is stored — think of PostgreSQL, one server in a single location, which means a single point of failure, one server processing all the requests. In a distributed database, the data is partitioned or replicated and stored in multiple locations — multiple data centers or servers distributed over a network. The benefits are availability and performance: you can store data close to where the user is in the network, which makes queries faster. The main idea is that it has to be transparent — the applications running on it don’t have to know the database is distributed; the system hides all the distribution details.
Partitioning Geospatial Data
Daniel: How does the data get onto these different servers?
Mo: The simplest way to partition data is round-robin — you take each record and dump it on a different location in turn. That ensures the same amount of data in each location, but it doesn’t take into account the geospatial distribution. For geospatial data you can come up with a better partitioning scheme — if you partition based on location, that automatically puts counties and the points nearby them in the same partition. Then when you do a spatial join, you don’t need to shuffle data around the cluster much; you can do the join locally and parallelize it across all the partitions. That follows the first law of geography — near things are more related than far things.
Load Balancing and Data Skew
Daniel: How important is load balancing, given some geographic areas have much denser data?
Mo: Load balancing is really necessary for parallel processing, and geospatial data is hardly ever uniform — it’s usually very skewed. If you have one partition for the Manhattan area of New York City and another for a desert area, the desert partition will finish fast because it doesn’t have much data, while Manhattan spends a lot of time. That’s the opposite of load balancing — you want every compute node to do the same amount of work. So you can’t just use a uniform grid; the partitioning has to take into account both the data skew and the proximity. You can use the algorithms behind geospatial indices like the R-tree or quadtree to come up with partitions that store data based on closeness in space while keeping the same amount of data in each leaf node.
Parallel Processing
Daniel: Give us a working definition of parallel processing.
Mo: The simplest idea: you have one task and you chop it into 10 subtasks that can be done independently, so you can finish that bigger task in a tenth of the effort and get the result 10 times faster. Ten people finish it 10 times faster, 100 people 100 times faster — that’s the ideal, a linear speed-up as you add more compute nodes. That’s why we talk about load balancing and partitioning: if the goal is to do things really fast, we need parallel processing, and that needs distributed databases.
Why Uber Needs Distributed Databases
Daniel: Can you give examples — using a company everyone knows, like Uber?
Mo: Data can be used in two ways. One is online transaction processing — a user-facing application. Uber uses a distributed database in the back end to run online customer-facing queries, like “find an Uber ride to the airport.” It shards and replicates the customer and driver information across multiple locations for availability and performance: availability because Uber receives tons of requests per second, and a single node can only handle so many; performance because all the customers and drivers in Scottsdale, Arizona, have their data in the same server, close to where it’s requested. The other use is batch analytics — analyzing the history of Uber rides, map matching, traffic forecasting models. That’s not user-facing, but it feeds into the final application, and it needs a distributed system so you can scale the analytics with parallel processing.
What Apache Sedona Is
Daniel: How does Apache Sedona fit into this?
Mo: Apache Sedona is a distributed spatial analytics platform — it provides tools for working with geospatial data in a distributed computing environment. If you want to run massive-scale batch analytics on data stored in your data lake or database, Sedona lets you load it, repartition it based on the geospatial aspect, and do parallel geospatial processing. It’s an open-source project under the Apache Software Foundation, with APIs in Scala, Java, Python, and spatial SQL. Sedona is not a database — it’s a computation engine that can load data from any data store: S3, Databricks, Snowflake, your PostGIS database, or just Parquet files. You load it into a Sedona cluster and run the same spatial SQL or Python workload you’re already familiar with, and it hides the distribution details from the end user.
Cloud-Native Formats and Unused Data
Daniel: Are cloud-native formats like Parquet going to replace the need for databases like PostGIS?
Mo: A relational database like PostGIS keeps data safe, consistent, and well-structured. Cloud-native formats were invented for a reason — many times we collect data and just dump it as-is, without curating it, in many different formats. Parquet makes it easy to store data in a data lake efficiently. There are efforts like Iceberg and Delta Lake to apply database-like consistency to those formats. So cloud-native formats aren’t here to replace the relational database — they’re complementing it. You can run the same queries on Parquet files in a data lake without migrating to PostGIS, though it comes with limitations, because a well-structured distributed spatial database can run queries more efficiently.
Daniel: Is the bit that’s missing the compute, the storage, or the tools?
Mo: Data storage is not a problem, and the compute resources in the cloud are not a problem anymore. Gartner reported last year that 97% of enterprise data remains unused — only 3% makes value. That doesn’t mean the data isn’t valuable. My personal opinion is the main reason is that enterprises don’t have the tools to put the data in the right context to drive business value. Like oil, data is only beneficial in the right context — and the word “context” means nothing without geospatial location and time. That’s the opportunity for the geospatial community: helping organizations assign the geospatial and temporal context to their data so they can drive business value out of it.



