Jonathan Lewis schreibt in seinem Artikel Functions über eine oft gestellte Frage:
The use of functions – a function with other selects (eg. calculate availability of a part) – is slowing down our system when we do a select over our product file.
Is there some kind of rule when functions should be used or when we should try to create a more complex – combined – SQL that does not use the function.
Can functions be used in the where clause without loosing a lot of speed?
Ein guter, empfehlenswerte Artikel.
Was ich aber noch erwähnen würde:
Wenn ich aus SQL eine PL/SQL-Function aufrufe, die wiederum ein SQL ausführt, wird jeweils ein Kontext-Switch zwischen SQL-Engine und PL/SQL-Engine und nochmals SQL-Engine durchgeführt. Dieser dauert nicht sehr lang, sagen wir mal eine Millisekunde. Aber wenn ich dies 1′000′000 mal mache, sind das schon 2′000′000 ms – als mehr als eine halbe Stunde…