From b875de6fb7998bbd7f089343b7da4dd358ac0ced Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Sat, 17 Jun 2023 21:25:30 +0530 Subject: [PATCH] perf: Index pick list field in stock entry and DN (backport #35738) (#35742) * perf: Index pick list field in stock entry and DN (#35738) We check if pick list is created against them but there's no index so we end up reading entire table. ``` +------+-------------+------------------+-------+---------------+----------+---------+------+--------+-----------+----------+------------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | r_rows | filtered | r_filtered | Extra | +------+-------------+------------------+-------+---------------+----------+---------+------+--------+-----------+----------+------------+-------------+ | 1 | SIMPLE | tabDelivery Note | index | NULL | modified | 9 | NULL | 207015 | 348940.00 | 100.00 | 0.00 | Using where | +------+-------------+------------------+-------+---------------+----------+---------+------+--------+-----------+----------+------------+-------------+ ``` After ``` +------+-------------+------------------+------+-----------------+-----------------+---------+-------+------+--------+----------+------------+-------------------------------> | id | select_type | table | type | possible_keys | key | key_len | ref | rows | r_rows | filtered | r_filtered | Extra > +------+-------------+------------------+------+-----------------+-----------------+---------+-------+------+--------+----------+------------+-------------------------------> | 1 | SIMPLE | tabDelivery Note | ref | pick_list_index | pick_list_index | 563 | const | 1 | 0.00 | 100.00 | 100.00 | Using index condition; Using w> +------+-------------+------------------+------+-----------------+-----------------+---------+-------+------+--------+----------+------------+-------------------------------> ``` (cherry picked from commit 433489a9e6822b127b2a62ea2bca0da872c1ab1b) # Conflicts: # erpnext/stock/doctype/delivery_note/delivery_note.json * chore: conflict --------- Co-authored-by: Ankush Menat --- erpnext/stock/doctype/delivery_note/delivery_note.json | 5 +++-- erpnext/stock/doctype/stock_entry/stock_entry.json | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json index 2adf9c310f9a..ff0e1b66bf8b 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.json +++ b/erpnext/stock/doctype/delivery_note/delivery_note.json @@ -1222,7 +1222,8 @@ "hidden": 1, "label": "Pick List", "options": "Pick List", - "read_only": 1 + "read_only": 1, + "search_index": 1 }, { "default": "0", @@ -1398,7 +1399,7 @@ "idx": 146, "is_submittable": 1, "links": [], - "modified": "2023-04-21 11:15:23.931084", + "modified": "2023-06-16 14:58:55.066602", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note", diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.json b/erpnext/stock/doctype/stock_entry/stock_entry.json index 9bf679b8955f..fe42b1f135c4 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.json +++ b/erpnext/stock/doctype/stock_entry/stock_entry.json @@ -577,7 +577,8 @@ "fieldtype": "Link", "label": "Pick List", "options": "Pick List", - "read_only": 1 + "read_only": 1, + "search_index": 1 }, { "fieldname": "print_settings_col_break", @@ -677,7 +678,7 @@ "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2023-06-09 15:46:28.418339", + "modified": "2023-06-16 14:59:10.917235", "modified_by": "Administrator", "module": "Stock", "name": "Stock Entry", @@ -738,7 +739,6 @@ "read": 1, "report": 1, "role": "Stock Manager", - "set_user_permissions": 1, "share": 1, "submit": 1, "write": 1