[feature] Query Optimizer

I’ve added small feature to Frappe Recorder to suggest potential indexes and add them from UI.

You can use this to rapidly address performance problems.

E.g. Customer complains sales invoice submission is too slow.

80% of the time I’ve seen cases like these, the root cause was some missing index on a column.

Now with this feature all you need to do is:

  • Record the operation (like submitting Sales Invoice)
  • Run “Suggest Optimization”
  • Wait for a while
  • Potential indexes are suggested
  • Click on the ones that seem useful and add index from UI.
  • Validate that it “helped”

If it’s in code, you might also want to add index in code so other users benefit from it.

Here’s how it looks:

Note: Suggestions are created based on VERY simple heuristics so in some cases they might not help at all. Adding indexes does add small cost to writes that might have to update the index, so be aware of this tradeoffs.