perf: use estimated count on item table

This commit is contained in:
Ankush Menat
2025-06-04 19:04:24 +05:30
parent 8e17054b67
commit 958cc6f8f8
2 changed files with 1 additions and 2 deletions

View File

@@ -236,7 +236,7 @@ def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=Fals
filters.pop("supplier", None)
description_cond = ""
if frappe.db.count(doctype, cache=True) < 50000:
if frappe.db.estimate_count(doctype) < 50000:
# scan description only if items are less than 50000
description_cond = "or tabItem.description LIKE %(txt)s"