5

I had to optimize a SQL-Query and i was able to cut the amount of time in half.

The business part of the company said it is still too slow, so i researched deeper and looked into the called functions which are used in every part where to claculate value X.

Found 20 similiar selects to get values which are summed up afterwards into three different variables. Thought this can be done in three selects with "sum", but then i found the dumbest thing is this function:

V1, V2 have the values from the selects
V3 is ja given value
X is the return value
the function returns another value

help = functionCall(parameter) - V1 -V2
X= help + V1 + V2 +V3

WTF im mean it does the selects for nothing...
X = functionCall(parameter) + V3

Comments
Add Comment