Hi,
I have a query like this:
SELECT * FROM table_1 t
WHERE
(
-- Clause A (very long clause that filters a lot of rows)
)
AND f(t.field) = 'Y' -- This function is heavy but it should filter few rows
This query it's very slow because I think it tries to evaluate f() for every row in table_1.
Howerver if I query to database:
SELECT f(t.field) FROM table_1 t
WHERE
(
-- very long clause that filters a lot of rows
)
It's very fast.
How can I hint the query to filter rows by clause A and then by function?
Thanks in advance!