Hi,
I also use hapi-fhir (1.4-snapshot) with Postgres and search and update operations can be slow, i think that's because some queries are using non indexed fields with filters. These operations became faster on my setup (2 GB RAM, Java 1.8, Linux Ubuntu 15.10) after adding indexes on these elements :
- hfj_spidx_token(res_id)
- HFJ_SPIDX_STRING(res_id)
- HFJ_SPIDX_DATE(res_id)
- HFJ_SPIDX_URI(res_id)
I do not use these tables : hfj_spidx_number, hfj_spidx_quantity so i did not investigated about them...
I haven't done precise measures, i just found the "slow" queries by running
SELECT * FROM pg_stat_activity ; on the Postgres database when the server was searching/updating my resources and analysing the returned running queries with
explain.
And I also created an index (
this one seems to be postgres specific) to do
like 'something%' searches on hfj_spidx_string(sp_value_normalized). This subject of indexes optimized for "like" queries is discussed here :
http://stackoverflow.com/questions/1566717/postgresql-like-query-performance-variations.
Note : Indexes become more helpful when the system is loaded with a lot of data (Database does not fit in RAM).
Sorry if my English is bad.
Emmanuel