Skip to content

Commit

Permalink
perf: Index pick list field in stock entry and DN (#35738)
Browse files Browse the repository at this point in the history
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 433489a)

# Conflicts:
#	erpnext/stock/doctype/delivery_note/delivery_note.json
  • Loading branch information
ankush authored and mergify[bot] committed Jun 16, 2023
1 parent 01ac54d commit 138462a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion erpnext/stock/doctype/delivery_note/delivery_note.json
Original file line number Diff line number Diff line change
Expand Up @@ -1222,7 +1222,8 @@
"hidden": 1,
"label": "Pick List",
"options": "Pick List",
"read_only": 1
"read_only": 1,
"search_index": 1
},
{
"default": "0",
Expand Down Expand Up @@ -1398,7 +1399,11 @@
"idx": 146,
"is_submittable": 1,
"links": [],
<<<<<<< HEAD
"modified": "2023-04-21 11:15:23.931084",
=======
"modified": "2023-06-16 14:58:55.066602",
>>>>>>> 433489a9e6 (perf: Index pick list field in stock entry and DN (#35738))
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note",
Expand Down
6 changes: 3 additions & 3 deletions erpnext/stock/doctype/stock_entry/stock_entry.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -738,7 +739,6 @@
"read": 1,
"report": 1,
"role": "Stock Manager",
"set_user_permissions": 1,
"share": 1,
"submit": 1,
"write": 1
Expand Down

0 comments on commit 138462a

Please sign in to comment.