Bahmni search by identifier slow (0.88)


We noticed that the Bahmni search by identifier is unusably slow in release 0.88. A typical search on around 50k patients took around 30 seconds. The primary cause of this is the % at the beginning of search in the search sql here

Fix - Either upgrade to 0.89 if you can, or patch the line and remove the prefix % (assuming you don’t need to be able to search with a wildcard prefix).


Is this from registration? We moved to lucene search for identifiers.

Yes Angshu, it was from registration. I think lucene search was introduced in 0.89.

@vinay @angshuonline @arjun We observed the same issue with Bahmni 0.93, especially within the OT module. Searching by patient ID is very slow. Was the fix made here applied to even other modules such as OT and Appointments? Cc @gsluthra

Hi @rubailly - which version of MySQL are you using with Bahmni? How long does it take now for a patient ID result to show up (and what is the total number of patients in your system)?

Thanks for your response @gsluthra ! For the MySQL version, here is what I get when I run select version(); from the command prompt: 5.6.48-log

The number of patients in the database is 45686

It takes long to get the search results, the average is 25 Sec TESTSofani

Is this the only place in bahmni where patient search is this slow, or are you seeing similar load times for patient ID search in other places… like Registration, Appointment, etc? This will help us understand if its only this API, or something across the board.

Might be a good idea for us to also explore if a DB index on Person ID can help speed up the search response (unless this is a Lucene Index response).

Appointment scheduling seems to bee slow too but takes around 10 Sec Appt

Searching by name is however very fast from the two apps (Appointments and OT)

Search by ID from the clinical module seems to be slow too CLINICAL

But registration seems Ok REG

Thanks for these details. Very helpful! @binduak @gokul - Can you please log an issue in JIRA for this specific investigation (need to check in 0.93 and LATEST).

1 Like

Hi @rubailly We created the JIRA card and added to the current board to investigate more on the slowness issue with API. We will prioritise this issue in the coming days. Thanks !

cc/ @gsluthra @gokul

1 Like

Hi @rubailly Started analysis on the issue. You can check few observations from our env’s added in the card

1 Like