Stripe provides https://stripe.com/sigma which allows users to write their own SQL.<p>If you had a multi-tenant Postgres DB, how would you build a system such as Stripe Sigma? Where each tenant can only query their own data obviously.<p>Thanks for any recommendations!<p>More notes that could be helpful:<p>* dozens of tables<p>* data latency should be minimized, but 5 minutes is fine.<p>* not "big data", <10 GB per tenant<p>* need a post-processing step (for example, add a column of current balance to each transaction in an accounting system)