in reply to Re^3: Question About Proper Use of Bind Variables in Perl DBI Scripts
in thread Question About Proper Use of Bind Variables in Perl DBI Scripts
It is true that a hard parse for a complex SQL statement takes more time than for a simple SQL statement.
However, doing a hard parse always takes more time than not doing it, and in some cases the parsing overhead is the dominating factor for the total execution time. All I wanted to say, therefore is that hard parsing has to be avoided, and that is exactly what bind variables are for.
Especially if the tables have been analyzed
Actually, I should think that building an execution plan is faster if the tables have not been analyzed. In the absence of statistics (gathered during an analyze), Oracle has to skip all its clever calculations and defaults to some hard-coded heuristics.
Of course, the quality of the resulting execution plan will suffer, so spending some extra time on gathering table statistics and using them is a good thing (And you can profit most from this extra cost when re-using the execution plan over and over by having bind variables)
So, to sum up, not using bind variables is absolutely killing your Oracle performance, and if you run queries in a loop, you should also give prepare_cached some serious considerations.
|
|---|