Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Impact of Package Size to Performance in Oracle 10g

Using Oracle 10g. The original Oracle designer for this project has moved on and those of us remaining are reasonable developer's for Oracle but we need some tuning and planning assistance.

We have compartmentalized procedures in 'like' packages, some (many) of which have grown in size to include many (50 ish) procedures of varying complexities.

At this point several small procedures (select ID from Contract where Item = 'xyz') in these larger packages take much longer 'than expected' to execute from inside a these packages (from TOAD, SQL Developer, or from .NET Oracle Provider) than it does if the proc is compiled on its own or into a smaller package. (Tables are indexed)

Should there be a performance cost for using such large packages even when calling relatively simple individual procedures or is there some 'other' factor we should be looking for?

(note: upgrade to Oracle 11 is planned but not 'imminent')

like image 793
Cos Callis Avatar asked Jul 14 '11 15:07

Cos Callis


1 Answers

The first time any method in a package is invoked, the entire package needs to be read into memory. In general, that is supposed to be an advantage on the assumption that if you are calling one method in a package, it's likely that many related methods will be called either by the one procedure you called or by subsequent application calls. But it does mean that the first execution is potentially slowed by loading much more code may strictly be necessary for the simple function. That penalty should disappear, however, once the package has been loaded into memory. It doesn't sound like you're talking about a problem with the performance of the first call of a procedure, though, which would tend to rule this out.

Is there any code in the package's initialization block that would run before the small procedure was executed that might be skewing the results?

How are you determining how long it takes to call these small procedures and what does "much longer" mean? Are you calling them a handful of times and measuring some small number of elapsed milliseconds and seeing, say, a 30% increase in execution times? Or are you calling them thousands of times and seeing a 1000% increase in execution times?

like image 116
Justin Cave Avatar answered Sep 29 '22 22:09

Justin Cave