SQL Performance (MOSC)

MOSC Banner

SQL Performance: returning scalar from select on complex view VS same select inside pl/sql function

edited Nov 1, 2016 5:00AM in SQL Performance (MOSC) 12 commentsAnswered

Hi Community.

I have a performance problem which I don't understand:

I have a very Complex view which joins various tables.

This:

SELECT value

FROM View

WHERE x=?

AND y=?

returns exactly 1 row, every join works index based according to explain plan.

If I do this select directly in sqldeveloper it takes some time and show some costs.

If I do the same select inside a pl/sql function and return the "value",

and SELECT function(x,y) FROM dual, it works much faster and explain plan shows much lower cost.

(no caching issue)

Can someone explain why this happens?

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center