I have a query which has the following
WHERE clause (note that this is a simplification. In the actual case the second parameter would be passed from code. But the following explanation applies to when executing from sql developer).
WHERE O_DATE>= greatest(sysdate-1, sysdate - 30)
which takes about 100 seconds, whereas
WHERE O_DATE>= sysdate-1 takes very little time.
I would assume both to take the same amount of time because
greatest(sysdate-1, sysdate - 30) should resolve to
Can someone tell me why the difference in execution time? And a way to work around it?
To add more context I am using the logstash jdbc plugin and trying to use the sql_last_value