frappe / hrms

Open Source HR and Payroll Software
https://frappe.io/hr
GNU General Public License v3.0
1.39k stars 729 forks source link

Employee Checkin is taking too long time to be saved #609

Closed mubi64 closed 1 year ago

mubi64 commented 1 year ago

Information about bug

Employee Checkin is taking too much time to be saved for my client, client’s employees are around 6000 and Employee Checkin records are almost 1200000, this line is taking around 7 seconds to execute in employee_checkin.py file

def validate(self):
        validate_active_employee(self.employee)
        self.validate_duplicate_log()
        self.fetch_shift()

self.validate_duplicate_log() this function is taking much time. Is there any solution for this.

Thanks

Module

HR

Version

Frappe Version: v14.26.0 (version-14) ERPNext Version: v14.10.0 (version-14) Frappe HR Version: v14.2.2 (version-14)

Installation method

None

Relevant log output / Stack trace / Full Error Message.

No response

Code of Conduct

ruchamahabal commented 1 year ago

@mubi64 Can't replicate. The query is fairly simple. So it shouldn't take much time. Something else might be a bottleneck. Can you upgrade HR to the latest instance and check? It's on 14.2.2 and the latest release is v14.4.3.

Many optimizations have gone in for the attendance flow.

mubi64 commented 1 year ago

@ruchamahabal You are right, query is fairly simple and it is executing instantly on a small set of records, but as I mentioned my Employee Checkin records are almost 1200,000 so maybe it is taking due to large amount of data?

ruchamahabal commented 1 year ago

@mubi64 update to the latest release and check Search index was added on the employee field in Employee Checkin doctype in v14.3.2

https://github.com/frappe/hrms/pull/517

mubi64 commented 1 year ago

Thanks @ruchamahabal for instant help. It is resolved after updating to latest version.