Doesn`t this mainly depend a) on the SQL engine in the background i.e. postgres of Aidbox is not a MPP engine and semi-scalable i.e.
https://www.starrocks.io would be a totally different kind of scalability - even
https://duckdb.org/ as these are vectorized (SIMD) and not row based datastores. b) it is also about updating the rows in a smart way i.e. not recalculating them over and over again i.e. via a materialized view/trigger based on record changes (i.e. there are only so many patients a doctor can see in a day the ingestion volume is rather limited for a single doctor / center of doctors with a couple of them) c) multi-tenancy is a thing. And again I would say it depends on the datastore i.e. BQ
https://cloud.google.com/bigquery/docs/row-level-security-intro?hl=de supports row level security where the IAM policy with certain tags will only give specific roles access to some rows. Sadly, I think this is not so convenient in postgres and you would probably have to branch it out i.e. if 1 medplum project 1:1 maps to an organization/tenant then each should have their own table with database user permissions.