When HAPI FHIR database partition mode fits your tenant or regional data layout
Use the database partition mode when you run a multitenant, multi-source or regional HAPI FHIR JPA server and need the partition boundaries to match how your data is stored, not only how requests are routed. The HAPI FHIR JPA partitioning documentation places each resource in a partition, and the partition can represent a tenant, a separate source of data or a regional grouping. That placement is the decision point: once you know which partition each resource belongs to, you can decide whether the database layout should reflect those boundaries or whether a single shared layout with partition identifiers is enough.
The partition mode you choose affects more than query behavior. It changes the schema layout that the server creates and expects, the steps you follow when upgrading to a later HAPI FHIR release, and the operational tasks your team performs for backups, restores, capacity planning and access reviews. A tenant that must be restored independently, or a region whose data must stay in a specific database instance, will push you toward a different configuration than a shared pool with logical separation. Ask your team to write down the partition keys, the expected number of partitions, and the restore and data residency requirements before you read any mode settings.
Mode names, configuration keys and their supported combinations change between releases, so confirm them against the partitioning documentation for the exact HAPI FHIR version you will run. Check how each option interacts with your chosen database and whether the schema migrator handles it for your target version. Ask your implementation partner or your own platform team to test the chosen mode against a copy of representative data, including a partition-level restore, before the design is approved. Any quote for this work should list the partitions in scope, the databases involved and the upgrade path.
Legacy partitioning, database partition mode and native database partitioning compared
This table compares three ways to separate tenants or data sets in a HAPI FHIR JPA deployment: legacy HAPI partitioning, HAPI database partition mode and native database partitioning or sharding. Read each row against your tenant count, isolation requirement and how much schema change your team can absorb. Version-dependent behavior is flagged, so confirm those cells in the HAPI FHIR documentation for the release you plan to run.
| Criterion | Legacy HAPI partitioning | HAPI database partition mode | Native database partitioning or sharding |
|---|---|---|---|
| When it fits | Multitenancy or region grouping in a single shared schema where the team wants partitioning inside the HAPI JPA model | Multitenant deployments that want partition handling at the database layer and are ready to plan the schema from the start | Very large data sets or strict isolation needs that justify database-level split, with a team able to operate the extra topology |
| Schema impact | Partition IDs are stored on resources within the standard HAPI schema; confirm column and index changes for your version | Changes the schema layout used by the JPA server; confirm which tables and columns differ and how the migrator creates them | Depends on the database product and design; HAPI schema may need adjustment to work with partitioned tables, so confirm with the database vendor |
| Tenant isolation | Logical separation by partition; all partitions share the same database instance and tables | Logical separation with database-side handling; confirm what isolation guarantees the mode provides in your release | Physical or stronger separation per partition or shard; isolation depends on how the database is configured |
| Operational effort | Lowest added effort; one database to back up, monitor and upgrade | Moderate; schema initialization and upgrade steps differ from the default, so test the migrator path before go-live | Highest; more databases or partitions to back up, monitor, rebalance and recover |
| Migration path | Existing deployments may already use it; confirm the supported route to database partition mode before switching | Typically chosen at initial setup; confirm whether an existing legacy-partitioned server can be moved and what export and reload steps apply | Requires a planned data migration between database layouts; plan it as a separate project with its own rollback |
| Limitations to confirm | Partition-aware features and search behavior vary by release; check the partitioning documentation | Initialization through the migrator flag has limits; confirm supported database products, flags and upgrade behavior in the HAPI FHIR docs | Not a HAPI-native feature; support depends on the database and the HAPI release, so confirm in both sets of documentation |
How the partition decision flows into schema setup
The flow starts with the partition need: multitenancy, separate data sources, or grouping data by region. It then branches on whether the server is new or already running, because an existing server needs its current partition setup checked before any change. The chosen partition mode feeds the migrator step, which initializes the HAPI FHIR JPA schema. Check the migrator path in the documentation for your exact HAPI FHIR version, since initialization behavior and its limits can change between releases. Treat the native database partitioning branch as a separate design review with your database administrator.
Decision path from partition need to schema initialization, with version checks marked.
Choosing the path for a new build versus an existing partitioned server
A greenfield server has no existing data, so the main decision is which partitioning model to adopt before the first schema is created. HAPI FHIR JPA partitioning places each resource in a partition, which can support multitenancy, separation of data sources or grouping by region. Settle the tenant or region model before loading anything, because the schema you initialize carries that choice forward.
- Settle the partition model first: Write down whether partitions represent tenants, data sources or regions, and name the owner of each partition key.
- Plan partition addressing and access: Define how clients reference partitions and how the authorization layer maps identities to partitions.
- Size the database for growth: Review expected table growth per partition with the team that will operate the database, and confirm your chosen database platform is supported for the mode.
- Initialize in a disposable database: Run schema initialization against a throwaway database and inspect the result before touching shared infrastructure.
- Record the decisions: Keep a short design record of the partition model, so later upgrades and audits can see why the schema looks the way it does.
Confirm in the partitioning documentation and your release notes which partitioning mode is recommended for new deployments, and whether moving to another mode later requires a rebuild.
A server already using legacy partitioning has stored resources, search behavior and clients that depend on its current layout. Moving to database partition mode changes how data is organized, so it is a migration project with its own test plan, not a simple setting change. Do not assume existing data is reorganized automatically when the new mode is enabled.
- Inventory partition usage: List each partition, the resource types stored in it, and every client or integration that addresses partitions directly.
- Choose the data path: Decide whether data moves through FHIR export and import into a new server or through an in-place procedure, and confirm which path your release documents for your exact versions.
- Back up and plan a freeze: Take a verified database backup and agree a write freeze window for the cutover rehearsal.
- Replay representative traffic: Run representative searches, writes and authorization checks against a copy to find changes in responses or access results.
- Define rollback: Write down how the server returns to the previous layout if verification fails.
Confirm with the vendor documentation whether an in-place path exists for your versions, and rehearse the chosen path on a copy of production data before scheduling any production window.
A server with a non-partitioned layout holds one data set with no partition boundaries. Adding partition mode later means deciding how existing resources are assigned to partitions, which may be one default partition or a mapping based on tenant, source or region. That mapping shapes search scope, authorization rules and reporting, so it needs owners and sign-off before any schema change.
- Decide the assignment rule: Determine whether all existing resources go to one partition or are split by a business attribute, and record who approves the rule.
- Review references across boundaries: Check how resource references and identifiers would cross proposed partition boundaries before choosing a layout.
- Plan for historical data: Confirm how resource history and data created before the change will be assigned and tested.
- Verify search and access per partition: Compare searches and access decisions before and after the change for each partition, using the same test queries.
- Document downstream impact: List reports, exports and consuming applications that assume a single data set.
Ask the vendor or test on a non-production copy how references across partitions are resolved in your release, since that answer determines whether the assignment rule is practical.
Initializing partitioned schemas with the migrator flag
This sequence takes a non-production HAPI FHIR JPA server from a confirmed release and JDK to a database schema that supports partitions, and verifies that each partition accepts and isolates data. Each step closes with a check so the team knows whether to continue. Copy the exact configuration keys and migrator flags from the documentation for your release.
Confirm version and JDK requirements
Before changing any configuration, the platform team confirms the HAPI FHIR release it plans to deploy and the JDK that release requires, using the HAPI FHIR versions page. The documentation lists JDK 17 for version 8.2.0, but the requirement for the release you choose must be read from the page for that release. Record the release number, the JDK version and the application server or Spring Boot baseline in the deployment record. Check: the test environment runs the confirmed JDK, and the application owner has signed off on the release number before the next step begins.
Enable partitioning in the server configuration
The platform engineer turns on partitioning in the JPA server configuration, using the configuration key named in the HAPI FHIR JPA partitioning documentation for the chosen release. Older blog posts and examples often use keys from earlier releases, so the key should be copied from the current page and checked against the running version. Keep the change in version control so the reviewer can see the exact diff. Check: a second engineer compares the configuration file with the documentation page and confirms the key name and value match.
Select the partition mode and partition plan
The architect sets the partition mode that matches the decision made for this deployment, whether database partition mode, legacy partitioning or native database partitioning outside HAPI FHIR. The mode determines what the migrator creates, so it must be fixed before schema initialization. Write down the partition identifiers the deployment needs, such as tenants, regions or separated data sources, and confirm with the documentation how each identifier is named. Check: a short decision record lists the selected mode, the partition identifiers and the owner who approved them.
Run the migrator with the schema initialization flag
The platform engineer runs the HAPI FHIR migrator against an empty test database using the schema initialization flag named in the documentation for the release. Confirm that the JDBC driver for the target database, such as PostgreSQL or Microsoft SQL Server, is available to the migrator, because the migrator cannot connect without it. Keep the full console output. Check: the migrator reports successful completion without errors, and the schema version recorded in the database matches the release confirmed in the first step.
Verify tables and partition metadata
The database administrator queries the database catalog to confirm that the expected HFJ tables exist and that the partition-related tables or columns named in the documentation for the release were created. Compare the catalog output against the list taken from the documentation, and investigate any table that is missing or unexpected before continuing. Confirm that the database's own partitioning features are either not in use or configured separately, so the two layers are not confused. Check: a written comparison of the expected and actual objects shows no unexplained differences.
Test each partition with create, read and search
The QA engineer sends a create, a read and a search request for each planned partition, using the request header or URL segment that the documentation specifies for the chosen release. Then the engineer runs a negative test: a resource created in one partition must not appear in a search made against another partition. Repeat the tests after a server restart to confirm the partition settings persist. Check: a saved test log shows the expected results for every partition and the negative tests return no cross-partition data.
Record the baseline before any promotion
The platform team stores the migrator output, the schema version, the configuration file and the test log as the baseline for this deployment. Before any production use, the team confirms in the documentation what the schema initialization flag does when it runs against a database that already contains data, and whether it can be safely repeated. Treat any unclear limitation as a blocker until the vendor documentation or the release notes answer it. Check: the baseline is signed off by the application owner and the security team, and it is stored where the upgrade team can find it.
Security and access controls that partitions do not provide on their own
A partition decides where a resource is stored, not who may read it. HAPI FHIR documents its security features as building blocks, so authorization, consent, search narrowing, audit logging and operational access all need explicit design alongside the partition scheme.
Authorization on every partition
Partition placement does not enforce who can read or write a resource. Use the AuthorizationInterceptor or an equivalent layer to map each tenant or region to the identities allowed to access it, and test that a token issued for one partition cannot read another. Confirm how requests without a partition identifier are handled before any tenant goes live. Partition placement is not access control.
HAPI security docsConsent and search narrowing
Consent rules and search narrowing interceptors decide which records a caller can see within a partition they are allowed to reach. Where patients or data sharing agreements restrict access, define these rules per partition and verify that searches, includes and history queries respect them. Chained and cross-partition searches need specific review because they can return data that single-resource checks would block.
BALP audit logging per tenant
BALP audit logging records access events, but it must be configured so that events can be attributed to the correct tenant and retained according to each tenant's requirements. Confirm where audit records are stored, who can read them, and whether a tenant's audit trail can be exported separately. Test with a sample read and a sample search to confirm the events carry the expected partition context.
Migrator database privileges
The migrator creates and alters schema objects, so it needs database rights that the running application does not. Use a separate account for schema changes, restrict the application account to the data operations it needs, and remove the migrator credentials from the runtime environment after upgrades. Confirm the exact privileges with the HAPI FHIR upgrade notes for your target version.
Backup scope per partition
Partitions share one database and one schema, so a database backup restores every tenant at once. If a tenant requires its own restore point or deletion timeline, a full database backup alone does not meet that need. Decide whether restores will be full, by tenant or both, document how a partial restore would be performed and tested, and confirm the procedure with your database team before go-live.
Tenant identifiers in logs
Partition identifiers can appear in server logs, metrics labels, traces and database slow query logs. Those identifiers may reveal which organization or region a request belongs to. Review what the logging configuration writes, restrict who can read operational logs, and set retention limits that match your data handling policy.
How partition mode changes backups, upgrades and day-two operations
The partition mode you choose decides what a backup actually protects and what a restore brings back. In a single HAPI FHIR JPA database, every partition's resources, versions, links and search indexes sit in the same HFJ tables, so a database backup covers all tenants at once and a restore returns them together. Partitioning inside one database does not give you per-tenant backup files. If your model is one database per tenant or one database per region, backup, retention and restore become per-database jobs, and the number of jobs grows with the number of tenants. Confirm with your database platform team which granularity your backup tooling can restore, whether point-in-time recovery is possible for a single tenant's data, and how long a full restore takes for the whole dataset. Then write down who approves a partial restore, because restoring one partition from a shared database is not a routine database operation.
Upgrades follow a similar split. Before you move to a new HAPI FHIR version, check the target version's Java requirement (HAPI FHIR 8.2.0 requires JDK 17, and you should confirm the requirement for any later release you target in the release notes) and plan how the schema migrator runs against the partitioned database. Schema changes apply to the shared tables, so one upgrade affects every partition at the same moment, and a failed migration becomes a whole-platform outage rather than a single tenant problem. Rehearse the migration on a copy of production data that contains realistic partition counts, and record the migrator's output, elapsed time and any manual steps. Ask the vendor or check the upgrade documentation for the migrator's behavior on your database engine, and confirm the rollback path before you schedule the change.
Day-two monitoring also changes with the mode. A shared partitioned database hides load imbalance behind aggregate numbers, so a single large tenant can slow searches for everyone while database-wide metrics look normal. Decide which signals you need per partition, such as request volume, search latency, storage growth and the largest tables by partition, and confirm that your metrics and tracing setup can label requests with the partition they belong to. Restore testing should verify tenant boundaries as well as data integrity: restore a known partition, confirm its resources are complete, and confirm that a client scoped to one partition cannot read another partition's records. Run this test after each upgrade and record the result as evidence for your security and compliance reviews.
Limits of the migrator flag and partition modes to confirm before you commit
Partition mode, the migrator flag and native database partitioning each change what the server and its database can do later. The cards below list the limits to verify against the HAPI FHIR version you plan to run, ideally in a proof-of-concept on a copy of your data.
Scope of the migrator flag
The migrator flag initializes or upgrades the database schema. It does not decide how resources are partitioned, how tenants are isolated, or which indexes your search patterns need. Confirm in the HAPI FHIR partitioning documentation and release notes which settings the migrator reads and which must be set in the server configuration. Run the migrator against a non-production copy and compare the resulting tables with what you expected.
Partitioning docsSwitching modes on a live server
Assume a partition mode cannot be switched on an existing server until you have verified it. Data written under one layout may not map cleanly onto another, and a rollback may require a full export and reload. Ask the HAPI FHIR maintainers or your vendor to confirm the supported conversion path for your version, and record the steps in your change plan before any production data is loaded.
Database engine support by mode
Partitioning behavior and the supported database engines are documented per release, and production deployments of the JPA starter use PostgreSQL or Microsoft SQL Server. Confirm that the mode and the engine you choose are both supported together in your target version, including the JDBC driver and dialect. Do not assume that a mode documented for one engine works identically on the other.
Interaction with terminology and MDM
Terminology services, MDM matching and partitioned data can each read across resource boundaries. Test whether a terminology load, value set expansion or MDM link operation behaves as expected when resources sit in different partitions. Write down which queries cross partitions and whether they return the results your clinical or patient matching workflows require.
Bulk operations and batch jobs
Bulk export, bulk import and batch jobs read and write large volumes that may be scoped differently by partition. Confirm whether each bulk operation honors partition boundaries in your version, and whether a tenant-scoped export can be run without exposing another tenant's data. Measure job duration on realistic volumes before you commit to a schedule.
Native partitioning and sharding support
Native database partitioning and sharding operate below the HAPI FHIR schema and can conflict with its own partition model. Confirm in the release notes for your chosen HAPI FHIR version whether the project supports these options, which tables and migrations they affect, and who will support the database layer if a query plan changes. Treat unsupported combinations as out of scope until a proof-of-concept shows otherwise.
Questions teams ask before hiring help with partition mode
What drives the cost of switching HAPI FHIR partition mode?
The biggest driver is how much existing data and how many integrations depend on the current layout, because that sets the migration and retesting work. Most of the cost is labor: someone must design the partition model, change the starter configuration and schema setup, rebuild and test search and access control, verify backups, and run the cutover. Some work recurs, such as keeping partition assignments aligned with tenants or regions as they change. Ask for the work broken down by phase, the environments covered, and the number of partitions in scope.
How long does an evaluation of partition mode take?
The length depends on a few drivers: the number of tenants or regions, whether data is already loaded, how many client applications query the server, and whether partitions are needed for data separation or only for grouping. An evaluation moves faster when requirements are written down and the HAPI FHIR version is fixed. It takes longer when the team first has to decide whether partitioning fits its tenancy model at all. Ask the provider to list the decision points and the inputs each one needs before agreeing on a schedule.
What does partition mode need from our database and identity teams?
The database team typically provides schema creation rights or a dedicated migrator account, backup and restore procedures, capacity planning, and change windows for the cutover. The identity team defines how partition membership maps to identity claims, how tenant identifiers appear in tokens, and which users or applications may read or write each partition. HAPI FHIR does not provide one-size-fits-all security, so authorization rules must be built with its interceptors and reviewed with the identity team. Confirm these owners and their availability before the scope is signed.
Can our internal team switch partition mode without outside help?
Yes, if the team already runs the HAPI FHIR JPA server in production, has a tested backup and restore path, and owns its upgrade process. Gaps usually appear in partition design, in testing that data in one partition stays hidden from others, and in moving data with minimal disruption. Check whether the team has run the JPA starter with the database you use, whether it has a non-production environment that matches production, whether it can run a parallel test, and whether someone is accountable for authorization rules per partition.
What does a fixed-scope partition mode engagement cover?
A fixed-scope engagement starts with a written scope, deliverables and timeline agreed before work begins. For partition mode, the scope should name the tenancy or region requirements being reviewed, the partition design, the configuration and schema initialization steps, the data movement plan, the authorization and test work, cutover support, and the documentation handed over. Anything outside that list, such as changes to client applications or new terminology loads, should be named as an exclusion or handled through a separate written change. Ask for the scope statement before comparing offers.
How is existing FHIR data moved into a partitioned server?
FHIR exports are a common route. Resources are exported from the current server and loaded into the partitioned server, with each resource assigned to its partition. Confirm the approach against the HAPI FHIR version in use, the data volume, whether resource IDs and version history are preserved, and how references between resources in different partitions behave. Copying the database directly keeps the existing layout, so test whether that layout suits the new mode before choosing it. The HAPI FHIR partitioning documentation is the natural starting point for these checks.
What should a written quote for partition mode include?
A useful quote lists the scope statement, the assumptions about environments and data volume, the work breakdown by phase, and the roles each side provides. It should also describe the test plan, the cutover and rollback approach, and the documentation delivered. Ask which costs are one-time and which recur, how change requests are priced, and what is excluded. List the access, staging environment and people the client must supply, because delays there often move the schedule. DeployOpen does not publish a price list, and a quote follows from the written scope.
How DeployOpen works on this
DeployOpen approaches HAPI FHIR database partition mode as a planned change to a self-hosted JPA server inside your infrastructure. The work starts with a written scope that fixes which partitioning need is being met, which database runs underneath, and how schema initialization will be handled before any build begins.
How we scope
- Confirm whether the need is multitenancy, data source separation or regional grouping before choosing a partitioning approach.
- Record the HAPI FHIR version, JDK 17 or later runtime, and target database in the written scope.
- Document which existing data, if any, must move into partitions and how it will be exported and loaded.
How we build
- Configure partition mode in a non-production environment, with the migrator flag run against a copy of the target schema.
- Test partition-aware searches, reads and writes against your access control rules before anything is promoted.
- Set up the PostgreSQL or Microsoft SQL Server database settings and check the schema initialization steps against your environment.
How we hand over
- Deliver a written configuration record covering partition settings, migrator steps and the limits found during testing.
- Provide a runbook for adding partitions, rerunning schema initialization and rolling back a failed change.
- Walk your platform and database teams through the build so they can review and operate it independently.
How we support
- Offer ongoing support, upgrades and continuous testing as a retainer after the initial handover.
- Retest partition behavior when you move to a new HAPI FHIR release, since upgrade notes may change how the migrator behaves.
- Confirm with your database vendor and our team how partition changes interact with backups and replication before going live.

