Re: Long Parse Time for a big Statement

From: Mladen Gogala <gogala.mladen_at_gmail.com>
Date: Mon, 17 Jan 2022 08:48:25 -0500
Message-ID: <7313d8c9-2fae-2da9-c7d3-9f7b01259e5f_at_gmail.com>


On 1/17/22 07:59, Lothar Flatz wrote:
> Hi,
>
> 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
>
>
Hi Lothar,

Obviously, as Dominic has noted, the usual DBA tricks like baselines are of no use here. That leaves you with only one option: change the model. Would it be possible to materialize the 55 tables view? Do you have any other repeating table combinations that could be put into another materialized view? Parsing SQL with >130.000 lines is really pushing it. You can also try encapsulating portions of the query into pipelined functions and then query them. PL/SQL is stored in the parsed form so no re-parsing will be necessary. However, that would mean a change in the SQL generation process.

Happy New Year!

-- 
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com

--
http://www.freelists.org/webpage/oracle-l
Received on Mon Jan 17 2022 - 14:48:25 CET

Original text of this message