From 8c1ee68ce6e6567d1fbffdc0d2129eb419ebdf2b Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Mon, 9 Jun 2025 13:05:00 +0530 Subject: [PATCH] perf: Skip order_by in link validation (#32848) ~10% faster because no QB overhead --- frappe/model/base_document.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frappe/model/base_document.py b/frappe/model/base_document.py index d7ae85c03f..b79724f53a 100644 --- a/frappe/model/base_document.py +++ b/frappe/model/base_document.py @@ -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()