Multi-tenant data
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    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 connections do 1,000 tenant databases need?

      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.

          1. 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:

          2. 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:

          3. 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:

          4. 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: