Sharding PostgresQL with HAPI FHIR

104 views
Skip to first unread message

Rico Aarntzen

unread,
Feb 5, 2025, 9:35:13 AM2/5/25
to HAPI FHIR
Hello all,

For improving scalability and performance we would like to shard our database across nodes. Ive searched the HAPI FHIR documentation but could only find information about partitioning.

So my question is: Is sharding possible with HAPI FHIR (7.6.0) and PostgresQL? 
And if so, how?

Thanks in advance for your answer(s).

Best regards,
Rico

Arne Van Eycken

unread,
Feb 5, 2025, 9:44:11 AM2/5/25
to Rico Aarntzen, HAPI FHIR

I will follow this as we have the same question


--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/hapi-fhir/74db93c1-ae07-46ae-8b8c-443114bb79bbn%40googlegroups.com.

James Agnew

unread,
Feb 5, 2025, 10:28:10 AM2/5/25
to Arne Van Eycken, Rico Aarntzen, HAPI FHIR
By sharding, are you referring to support for Postgresql Table Partitioning?

If so, I guess the answer is that it's not yet supported, but this is coming as a part of our Feb release which is out this month. We will be writing a bunch more about how to do this in the next few weeks, but the next release introduces a feature called Database Partitioning Mode which will enable support for native database partitioning:


Cheers,
James

Rico Aarntzen

unread,
Feb 5, 2025, 10:50:55 AM2/5/25
to HAPI FHIR
Hi James,

Thank you for your answer. I was referring to sharding data and not partitioning. Like this: (https://wiki.postgresql.org/wiki/WIP_PostgreSQL_Sharding)
I see some PostgresQL extensions like Citus (https://docs.citusdata.com/en/stable/get_started/what_is_citus.html) I can try to use with HAPI FHIR.
Not sure if anyone else already tried this with success? Do you know if this works/doesn't work James?

Thanks in advance,
Rico
Op woensdag 5 februari 2025 om 16:28:10 UTC+1 schreef james...@gmail.com:

Muhammad

unread,
Apr 21, 2026, 9:33:43 AMApr 21
to HAPI FHIR
Hello Rico,

Did you find any working solution for Sharding? 

We have attempted CitusData migrated the Hapi_r4 tables but the Hapi_Fhir_JPS_Server is so strict that it is every time checking the schema and refuses to start. We have tried many application configurations, but non of them seems to work.

Any help or guidance is appreciated.

Best Regards,
M

James Agnew

unread,
Apr 21, 2026, 9:39:32 AMApr 21
to Muhammad, HAPI FHIR
Hi Muhammad,

Supporting Citus Sharding requires a bunch of schema tweaks and changes to specific query strings. Support is currently only available as an option with our commercial package (Smile CDR / OmniVera).

Cheers,
James

Muhammad

unread,
Apr 22, 2026, 1:32:01 AMApr 22
to HAPI FHIR
Hi James,

Thank you for the quick clarification regarding Citus Sharding.

Regarding the commercial package (Smile CDR / OmniVera), could you confirm if it supports on-premises deployments, or is it restricted to a specific cloud provider?

Regarding the technical side, we have already made significant progress on the migration:
  • Modified the schema for hapi_r4.
  • Distributed 22 tables and added sharding key columns.
  • Converted the rest of the tables to Reference tables, and other remaining tables are kept as Local tables.
  • Updated constraints and indexes across the board.
We pointed the Hapi_Fhir_Jpa_Server connection string to the Citus coordinator and disabled schema initialization. However, the server is still crashing.

Does the commercial package include a specific storage mapper or SQL dialect designed for Citus that handles these query string changes?
Looking forward to hearing from you.

Best Regards,
M

James Agnew

unread,
Apr 22, 2026, 6:07:51 AMApr 22
to Muhammad, HAPI FHIR
> Regarding the commercial package (Smile CDR / OmniVera), could you confirm if it supports on-premises deployments, or is it restricted to a specific cloud provider?

On-prem deployment is supported. It's intended to be a fairly straightforward migration path for most HAPI JPA users.

> Does the commercial package include a specific storage mapper or SQL dialect designed for Citus that handles these query string changes?

Yup that's exactly it, plus Citus is a part of our standard upgrade/release QA cycle these days.

Cheers,
James


Reply all
Reply to author
Forward
0 new messages