Layer 3 · Go deeper · 7 min
Go deeper
Size it, build it, then make the calls an interviewer will push you on.
Back of the envelope
Size it up
Tap through each step of the arithmetic.
How many relations do 5,000 tenant schemas hold?
Can one DynamoDB partition key absorb megamart’s flash sale?
Build-up · 5 steps
Watch row-level security catch a forgotten filter
One acme request on a pooled connection, a report query that forgets its tenant filter, and the policy that catches it.
Step 1 of 5
An acme user asks for invoices
Tenant context comes from the signed token, never a parameter the client controls. The app connects as a role that owns nothing, so row-level security applies to it.
4 interview moments
You’re the candidate
The interviewer pushes on the hard parts. Pick an approach and see how it holds up.
Deep dive 1 of 4
Interviewer
“Thousands of tenants share your invoices table. How do you make sure a query that forgets its tenant filter can’t leak?”
Your move. Pick an approach:
Deep dive 2 of 4
Interviewer
“Your RLS policy reads app.tenant_id, and requests share connections through PgBouncer in transaction mode. How do you set the tenant?”
Your move. Pick an approach:
Deep dive 3 of 4
Interviewer
“Thousands of small tenants, plus a few enterprise customers whose contracts demand separate storage, their own keys and single-tenant restores. Your layout?”
Your move. Pick an approach:
Deep dive 4 of 4
Interviewer
“Say megamart’s flash sale writes 2,500 orders a second, 2 KB each, into your pooled DynamoDB table keyed by tenant. What now?”
A partition takes at most 1,000 write units a second, and one unit is one write of up to 1 KB.
Your move. Pick an approach: