perf: Skip order_by in link validation (#32848)

~10% faster because no QB overhead
This commit is contained in:
Ankush Menat 2025-06-09 13:05:00 +05:30 committed by GitHub
parent f9ff807e4c
commit 8c1ee68ce6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -898,9 +898,13 @@ class BaseDocument:
values_to_fetch += ("docstatus",)
if not meta.get("is_virtual"):
values = frappe.db.get_value(doctype, docname, values_to_fetch, as_dict=True, cache=True)
values = frappe.db.get_value(
doctype, docname, values_to_fetch, as_dict=True, cache=True, order_by=None
)
if not values: # NOTE: DB Value cache does negative caching, which is hard to remove now.
values = frappe.db.get_value(doctype, docname, values_to_fetch, as_dict=True)
values = frappe.db.get_value(
doctype, docname, values_to_fetch, as_dict=True, order_by=None
)
else:
values = frappe.get_doc(doctype, docname).as_dict()