Note: This is in V15.
I have found an oddity when using frappe.get_all with an ‘in’ filter with empty values, in that it is pathologically slow for some reason (e.g. 0.3 seconds on my machine, when it should really be almost a no-op). Obviously you wouldn’t intentionally pass an empty list to ‘in’ but it can happen in many circumstances.
For example, I find:
frappe.get_all(‘Item’, filters={‘item_code’: [‘in’, []]})
takes significantly longer (0.3 seconds) than
frappe.get_all(‘Item’, filters={‘item_code’: [‘in’, [‘NotARealValue’]]})
which is effectively instant (item_code is an index).
I’ve written (or rather got Claude to write) a get_all function that checks for empty ‘in’ filters and just returns [] immediately in that case. It’s not measurably slower than get_all in the general case but hugely faster in the specific empty list case. I assume something dumb is happening internally like the filter is being dropped if empty, all rows are being returned, and then all rows are subsequently filtered? It’s a bit weird…
This was genuinely causing the biggest slowdown for some of our operations (on a heavily customized system where I need to get much better at adding relevant indexes!).