Suppose we have 2000 parking space. this is just a table which will store the facts related to parking lot. parking lot id, parking lot number, parking lot size. Size of it is fixed since we have only 2000 parking space. So this table will have data of size considering each field is taking 4 bytes. So, size of 1 record will be 4 * 3 = 12 bytes. There are 2000 parking spots 12 * 2000 = 24000 bytes. Just for parking fact table
considering a slot can be booked for at-least 1 hour worst case scenario is we in an hour we will have number of booking = 1 * 2000, for the entire day it will be 24 * 2000 = 48000, now for entire year 48000 * 365 = 17, 52, 000 bookings.
If the bookings table contains booking id, parking lot id, start time, end time, transaction id, user id
considering each field takes 4 bytes, size of 1 record = 4 * 6 = 24 bytes
For a year = 24 * 17, 52, 000 = 4, 20, 48, 000 bytes
For n years n * 4, 20, 48, 000 bytes
Since 2 people cannot book same parking slot at same time the database should be consistent so we should choose a system which is ACID compliant not a db which is eventually consistent NoSQL. For our use case will use any SQL database. I will choose a PostgreSQL database.
bookings table
users table
parking lot table
transaction table
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.