RE: Long Parse Time for a big Statement

From: Mark W. Farnham <mwf_at_rsiz.com>
Date: Tue, 18 Jan 2022 08:34:28 -0500
Message-ID: <068701d80c70$1e1bd2c0$5a537840$_at_rsiz.com>



I failed to ask “who controls the generator?”  

That is where you would need to intervene (as opposed to doing all the things “Tuning when you cannot change the code”) to re-write the query.  

When you’re not allowed to test alternate writings of the SQL and when you’re not allowed to see the entire execution stack problem resolution is certainly more difficult.  

I think of Moans in such situations: “Don’t complain when they are causing you to make more money.” On the other hand it is more non-monetarily satisfying to yield good solutions quickly.  

You have my sympathy. Good luck!  

mwf  

From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Lothar Flatz Sent: Tuesday, January 18, 2022 3:19 AM
To: mwf_at_rsiz.com; jlewisoracle_at_gmail.com; oracle-l_at_freelists.org Subject: Re: Long Parse Time for a big Statement  

Hi Mark,

yes, the query should be rewritten and getting rid of the inlists would be one approach I favour. An other idea would be getting the case statements into compiled code. Even if I start the statement directly on the server parse time is high.

Thanks

Lothar

Am 17.01.2022 um 22:45 schrieb Mark W. Farnham:

AND, not but to anything already the thread, it is often the case that stuffing the inlists into a temporary table with a nomerge inline view join to the table it filters simplifies the optimization (whether or not it is the fastest plan). A further optimization is to toss on the “and between” the low and high values in the inlist, with or without the temporary table.

<snip>
At one customer site we see generated statements, actually reports. The parsetime for such a statement is over an hour, if it finishes at all. It is possible we see "ORA-04031:" when we run out of memory in the shared pool.
How big these statements are is hard to tell, since it depends on formatting. With sql developer formatting i get in one typical example > 130000 lines.
The statements are constructed relatively simple. It seems to be a kind of change report where columns from different tables are retrieved.
At the beginning is a big case statement where a meaningful name is generated for a value followed by this values. I counted 7400 case entries as per statement in one case.
I addition we have a number of big inlists. All this is running against a union view of 55 Tables. In other words: If i want to stress the parser I would construct a statement exactly like this.
However, one hour seems to be a unrealistically long parse time. Even though that statement needs to be rewritten, but this will take time. I want to know if there is any quick fix like increasing the shared pool a lot. (Which I can't test unfortunately any time soon due lack of memory). Any ideas how to speed up the parse time?

Database version is 19.7. Shared Pool size is 20GB

Thanks

Lothar
--

http://www.freelists.org/webpage/oracle-l  

--

http://www.freelists.org/webpage/oracle-l Received on Tue Jan 18 2022 - 14:34:28 CET

Original text of this message