How can I increase performance when I run Oracle Views? I have an Oracle View, it looks something like this:
SELECT ...
FROM myview p
WHERE p.param1 = 'x' AND p.param2 = 'y' AND p.param3 = 'z'
The code of the view is (analogously):
SELECT a.param1, b.param2, c.param3
FROM atab a
JOIN btab b
ON a.id = b.blaid
JOIN ctab c
ON b.id = c.blaid
The running time of myview with condition is round about 13-14 secs. When I let run the query with condition:
SELECT a.param1, b.param2, c.param3
FROM atab a
JOIN btab b
ON a.id = b.blaid
JOIN ctab c
ON b.id = c.blaid
WHERE a.param1 = 'x' AND b.param2 = 'y' AND b.param3 = 'z'
the running time is round about 0,3 second.
I understand this so that Oracle first fetches all data of myview, and after this applies the Filter. But I'm not very sure. If I run the query directly, Oracle has the option only get the data that is actually needed (because in the execution, the condition can be considered immediately). But here I'm not very sure also.
The question is, when the view has a complex structure and its existence is justified, how can I solve the performance Problem?
I think about a solution, for example with a function with parameters. The query could be executed immediately with a where-condition.
Are there other possible solutions?