When to write SQL on PL/SQL table




When to write SQL on PL/SQL table
-----------------------------------------------------------------------------------------------------

collections can be used to cache static data in pl/sql.

keeping more data in pl/sql table hurts performance because the PGA grows more

 
write the sql for plsql tables only when data transer rquried from SGA  to PGA and then move the data to database.

...

notes on context switching :

The basic example of costly context switch is calling a PL/SQL function in a where clause when you could do it purely in SQL. In that cas the main SQL does a context switch on each row tested, and if the PL/SQL function is actually doing SQL inside, that is another "nested" context switch.
Doing so on a million rows would "hurt" performance wise.


 

Comments