Design a Product Analytics System, stage 1 of 9: model
What one chart has to read
Use 86,400 seconds a day and 1 KB an event. A large team sends 300 million events a month, and its daily-signups chart filters on two properties over 90 days.
System so far· 5 parts
Select a component to see what it is responsible for and which state it owns.
- 1Customers' apps → Capture API: Batches of events
- 2Customers' dashboards → Query service: Chart request
- 3Query service → Postgres: Teams and saved charts
What you need to know
0 of 3 checks done
Work it out
2 billion events a day. About how many events a second on average?Work it out
At about 1 KB per event, how many terabytes of raw events arrive per day?A row store like Postgres keeps each row's fields together on disk. To count rows, it reads whole rows, every field, even if the query uses three of them.
An index helps find rows. It doesn't make reading them cheaper once they're found.
Work it out
A chart needs 900 million events, using 3 small fields from each 1 KB event. Reading whole rows, about how many gigabytes are read?