We're building a system where the data in 10 tables is associated with Accounts. A typical table looks like this:
create table Things(
accountId varchar(64) not null,
internalId varchar(64) not null,
externalId varchar(256) as (concat(accountId, '-', internalId)) stored,
...
primary key (accountId, sourcedId),
unique (externalId),
foreign key (accountId) references Accounts (id)
);
All queries either have an accountId
in the where
clause, or they use externalId
. There are no cross-account queries.
We're expecting to have a total of 200 accounts. The sizes of the other tables (like Things
) vary from 5 rows per account for some tables (1000 rows total) to 225K rows per account for some other tables (45M rows total). (These are the numbers we use for performance testing - they're the max numbers)
The DB size is ~150 GB. 95% of the scenarios are reads.
The RDBMS is Mysql 8.0.16 (AWS RDS).
We don't have any performance issues at the moment and we're not trying to make anything work faster. But I'm wondering if NOT partitioning the tables like Things
by accountId
is a "premature pessimization"?