Say I have a function:
function sorter(a,b)
And it has a rule for defining if row value a is "bigger" than row value b (so returns 1 if a>b and -1 if row value a is "smaller" than bigger than row value b.
Can I sort the results by this function?
An example could be the "log" math function function (bad example because it's monotonic increasing), with a and b being positive integers.
The only way I can think of doing this is by simply getting all the rows matching my query and then looping through them one by one and using my sorter function to sort them. The data set has returned > 30k rows in my example queries and I am estimating up to 100k rows could be returned in the worst case scenario. So I would prefer not to loop through the results (this is for a web application and needs to respond in realtime).
Edit: I should add, the sorter function is time dependent and features variables that change value over time. So precomputing is not an option.