Re: Library Cache
Date: Mon, 29 Dec 2008 07:15:20 -0800 (PST)
On Dec 29, 9:09 am, Mark D Powell <Mark.Pow..._at_eds.com> wrote:
> On Dec 29, 9:53 am, mrdjmag..._at_aol.com wrote:
> > Hi,
> > We installed this Spotlight for Oracle software. The software shows
> > an 85% re-parse rate against the Library Cache. Here is the biggest
> > issue we have. I do not think anything can be done, but maybe another
> > brain can figure something out:
> > We have a table with stored queries:
> > Row 1: SELECT emp_num FROM employees
> > Row 2: SELECT address FROM customer_address
> > We have a criteria table which holds any criteria that the query MAY
> > use:
> > Row 1: WHERE emp_first =
> > Row 1: AND emp_last =
> > Row 2: WHERE customer_id =
> > So, the PHP code can pass any number of parameters to the procedure,
> > which the procedure can parse and form the query and open a cursor for
> > the PHP code to read.
> > This means that the queries may/may not be the same, and need to be re-
> > parsed. So, we lose on that. Is there anything that can be done to
> > tune these and make them faster? An index against every possible
> > combination is not possible, and we have hundreds of these stored
> > queries........
> > Any smarter people have any ideas?
> > Arthur
> If the SQL built from the logic includes constants for the where
> clause conditions you could change it to use bind variables in the
> code. This would give you some reuse.
> You could replace the SQL in tables with SQL housed in stored
> procedures that determines the SQL to be submitted based on the
> parameters passed in. These statements would all use bind variables.
> The procedures could pass cursors back to the application.
> Take a look at the value of your database parameter cursor_sharing.
> The default is EXACT. You might be able to get some benefit from
> changing it to SIMILAR or FORCE. SQL plan changes are possible if
> this parameter is changed so some tuning may be required.
> HTH -- Mark D Powell --
All the criteria stored in the criteria are parameters passed in. If no criteria parameter for a given query, then it is not appended to the query. So, for Row 1 above, I can pass in 0, 1 or 2 parameters, and the query will be formed properly and results passed back to the PHP application. That means the criteria parameters are variable, right?
Big issue is that the stored procedure that does all this is used hundreds or times all over the application. So, changing the calling and such is kind of out of question.
Maybe the idea is to replace all EXECUTE IMMEDIATE calls with proper bind variables and tune those...... Received on Mon Dec 29 2008 - 09:15:20 CST