<aside>
This section is part of the 5-hour System Design course by Mukul Raina
Section 8: Database Design

A ride-sharing platform does not have one database. It has several, each chosen for a specific data type and access pattern. User profiles live in PostgreSQL. Real-time driver positions live in Redis. Location history lives in a time-series database. Payment transactions live in their own PostgreSQL instance with ACID guarantees. The architectural question is not “which database should we use?” It is “which database should we use for each data type, and why?”
This section makes that decision for every data type in the system, defines schemas with concrete column names and indexes, and explains the sharding strategy that makes geographic partitioning work.
What We’ll Cover:
This section connects backward to Section 5 (Data Flow), where we defined which services own which data, and forward to Section 11 (Scaling), where we scale these databases across regions.
<aside>
Mukul Raina | youtube.com/@mukulraina | slides.mukulraina.com | LinkedIn
</aside>
Each Service Owns Its Database
No service directly queries another service’s database. Trip Service owns trip records. Location Service owns positions. Payment Service owns transactions. If Matching Service needs trip data, it calls Trip Service’s API or consumes its Kafka events. It never runs SQL against Trip Service’s database.
