In one of the Bahmni implementations where we have relatively large DB of patients, approximately 175,000 patients, when user tries to search for duplicate patients based on Birth Date, Gender, Family Name and Given Name, the query times out. And if user keeps performing the same operation repeatedly then Java runs out of memory and even deadlock is created on some occasions. This leads to OpenMRS service to be restarted. And there is no way for the user to proceed with the patient merging.
Currently the search for duplicates on Gender, DOB, Family Name and Given Name times out. After the fix it takes approximately 50-55 seconds to search for duplicates based on this criteria in DB with 175000 patients.