I have a large mysql table with two columns A and B. I want to SELECT from it ordering by A minus B.
I have tried indexing A and B separately as well as indexing A and B together. The query however takes several seconds regardless.
I haven't found anything about creating an index like (A-B), but I figured that this problem can't be that uncommon. Is there a solution for this?
The only workaround I came up with is to add an extra column A-B and index that, but it doesn't feel like a good solution.