Return-Path: <oracle-l-bounce@freelists.org>
X-Original-To: oracle-l@orafaq.com
Delivered-To: oracle-l@orafaq.com
Received: from smtp-aa.freelists.org (smtp-aa.freelists.org [23.23.80.81])
 by malta2546.startdedicated.com (Postfix) with ESMTPS id CAF8810032B976
 for <oracle-l@orafaq.com>; Thu, 29 Apr 2021 16:56:29 +0200 (CEST)
Received: from turing.freelists.org (ip-10-0-0-164.ec2.internal [10.0.0.164])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by smtp-aa.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id A294B425FC;
 Thu, 29 Apr 2021 14:56:26 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by turing.freelists.org (Postfix) with ESMTP id 97B45408A5;
 Thu, 29 Apr 2021 14:56:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=freelists.org;
 s=turing; t=1619708186;
 bh=9dhCvxl/g7iCTHtxtz6q/8ZXJ4EHJgudIcA4EjVZqCI=;
 h=From:Sender:Sender:From;
 b=tinWn1+lM8SF/MVYGkK/vgWlGRprCPfTJF0dT9asQwrQu3RsCytdcE6/+N1xw2ie6
	 1+yRoC47R3b9M68HBcgaeed2wYt1u+MFfL6UG37VHyGAgDz5trWw5SAfrXQTW/TpGE
	 zfjg80XQgrJKY3IH5NOHiCydOiLOktzqjdUYj9Mo=
X-Virus-Scanned: by FreeLists at turing2.freelists.org
Received: from turing.freelists.org ([127.0.0.1])
 by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id XQAFky40bK2e; Thu, 29 Apr 2021 14:56:26 +0000 (UTC)
Received: from turing.freelists.org (localhost [127.0.0.1])
 by turing.freelists.org (Postfix) with ESMTP id 45C91408A6;
 Thu, 29 Apr 2021 14:56:24 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=freelists.org;
 s=turing; t=1619708185;
 bh=9dhCvxl/g7iCTHtxtz6q/8ZXJ4EHJgudIcA4EjVZqCI=;
 h=From:Sender:Sender:From;
 b=TGpVGtZre3/+BVn7xioDZibHHVJwFO9r2dQeEl6it4LWOCxOOF397FI+Xo7EBF9H6
	 Sn121ojeoHAXExxkhUwbjSEli9qD6P+udXlMQBb6VvqPMkVHNgtG6QRKpm9VC8BaUv
	 cNFGv4kRoy31vNb2rojsS5Ww4fZznbP3gkYR1Yyc=
Received: with ECARTIS (v1.0.0; list oracle-l); Thu, 29 Apr 2021 14:56:23 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by turing.freelists.org (Postfix) with ESMTP id E228140293
 for <oracle-l@freelists.org>; Thu, 29 Apr 2021 14:56:22 +0000 (UTC)
Authentication-Results: turing.freelists.org;
 dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=bNlwJ0ht;
 dkim-atps=neutral
Received: from turing.freelists.org ([127.0.0.1])
 by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id ZARUBwuTZ5SN for <oracle-l@freelists.org>;
 Thu, 29 Apr 2021 14:56:22 +0000 (UTC)
Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182])
 (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by turing.freelists.org (Postfix) with ESMTPS id D516F3FFCC
 for <oracle-l@freelists.org>; Thu, 29 Apr 2021 14:56:22 +0000 (UTC)
Received: by mail-qk1-f182.google.com with SMTP id u20so35250811qku.10
        for <oracle-l@freelists.org>; Thu, 29 Apr 2021 07:56:22 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:references:in-reply-to:from:date
         :message-id:subject:to:cc;
        bh=Dw/gxi5GUWczVy40oJCzfQ5sHwKoP1+hONYfGg49ybk=;
        b=KuzR7vm6tes4Qjkg7ry256NlA5Wbi6dqRKbcXsWLXtmSu/U1c92ZADH8nctTrp2zcD
         ywiXWxiij3gwf3g+GRoWWzsp6ZeXuR862UwVCUyGLFe2Kn6HhFgzNCQWY79paib8QA4H
         bpiOCg/hPaXxjkO3203LWdGt0SHtz93e6RmfVlVKpl5lF8rDWImPNfLSfy0YAh35lhRd
         S3iY3/pDabQRa/TvL6IEk8rIAd94RpUR59zfgx/8lqIHfbXvZl2Gmn9Q1HGzewCRKMai
         oYOBdShklV+O6GjQiY0QxfAZ3eEyiWiBPnku9XKhAX3svEf3bxTUgvkPaVyCcvvFGezT
         OAJA==
X-Gm-Message-State: AOAM533cs0eTb6YQ3PGnZ0To1sZgrVNJDzqXXOmOR3T1e2qM3t3qucGy
 uogkFewTZeGEr9/stnQ8fCwXYd9paz8nwwBCw7i/j4NwbA0=
X-Google-Smtp-Source: ABdhPJwJOyYa+5+LG1IK7NDTCooSG13emiTvxBac9h+Bhe3VhfrSPTJaa2vAcZdTgJbZj/CGm6iUXQu7e8T3XMBc05g=
X-Received: by 2002:ae9:e886:: with SMTP id a128mr85247qkg.20.1619708182251;
 Thu, 29 Apr 2021 07:56:22 -0700 (PDT)
MIME-Version: 1.0
References: <!&!AAAAAAAAAAAYAAAAAAAAAJxRhRLvfEhBnlOLJd92a2XCgAAAEAAAAMySQHDPo19ImOKPJlpK8owBAAAAAA==@kbi-gmbh.de>
 <CAGtsp8ntbsnqbTFe-Mra7qkoFK8zeysin-dnMhStX7mvW6qvbA@mail.gmail.com>
 <!&!AAAAAAAAAAAYAAAAAAAAAJxRhRLvfEhBnlOLJd92a2XCgAAAEAAAAOsutvvuySpLgukjkxjS8lcBAAAAAA==@kbi-gmbh.de>
 <CAGtsp8=qgQYmKPdv4wjBE8A=Gv5otFDES8hNGZ1n+tzqJpB0cA@mail.gmail.com> <!&!AAAAAAAAAAAYAAAAAAAAAJxRhRLvfEhBnlOLJd92a2XCgAAAEAAAALv3/GqBnNpGltukP6vjVOcBAAAAAA==@kbi-gmbh.de>
In-Reply-To: <!&!AAAAAAAAAAAYAAAAAAAAAJxRhRLvfEhBnlOLJd92a2XCgAAAEAAAALv3/GqBnNpGltukP6vjVOcBAAAAAA==@kbi-gmbh.de>
From: Jonathan Lewis <jlewisoracle@gmail.com>
Date: Thu, 29 Apr 2021 15:56:07 +0100
Message-ID: <CAGtsp8=Z5JK5jsNQCAE0WLrxEAkUBkQgxZbdrui8QiGWJbPoXg@mail.gmail.com>
Subject: Re: fragmented sysauth$ table
To: Willy Klotz <willyk@kbi-gmbh.de>
Cc: ORACLE-L <oracle-l@freelists.org>
Content-Type: multipart/alternative; boundary="000000000000d7caa205c11db29b"
X-archive-position: 79741
X-ecartis-version: Ecartis v1.0.0
Sender: oracle-l-bounce@freelists.org
Errors-to: oracle-l-bounce@freelists.org
X-original-sender: jlewisoracle@gmail.com
Precedence: normal
Reply-To: jlewisoracle@gmail.com
List-Help: <mailto:ecartis@freelists.org?Subject=help>
List-Unsubscribe: <mailto:oracle-l-request@freelists.org?Subject=unsubscribe>
List-software: Ecartis version 1.0.0
List-Id: oracle-l <oracle-l.freelists.org>
X-List-ID: oracle-l <oracle-l.freelists.org>
List-Subscribe: <mailto:oracle-l-request@freelists.org?Subject=subscribe>
List-Owner: <mailto:>
List-post: <mailto:oracle-l@freelists.org>
List-Archive: <https://www.freelists.org/archive/oracle-l>
X-list: oracle-l
--000000000000d7caa205c11db29b
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

I read your email, take another look at what I said in mine:

>
> the 4 queries that (I assume) will have accessed sysauth$ in your trace
file.
>

The 4 queries that were in the trace file you generated (and the tkprof
output you supplied) had the following SQL IDs
SQL ID: f8pj3d8v9wz1b Plan Hash: 3253291735
SQL ID: cjjjhss73p058 Plan Hash: 3316561731
SQL ID: 9jbkynurzb23x Plan Hash: 2486390249
SQL ID: 5dqz0hqtp9fru Plan Hash: 1435697754

None of them match the 4 that I listed from 19.3 in my previous post. Was
this an instance running with the patch from 20.1 or an unpatched 19.8 ?
It is possible to apply an SQL Patch to sys-recursive SQL, but it's not
really desirable, but you could do some testing to see if you can find a
better path for the query.

I assume the table stats reasonable accurate and the problem is related to
the number of privileges per role or the number of roles, or the number of
roles per grantee. In short, something about the pattern of roles and
privileges is probably not one that Oracle expects, so if you're unlucky
the statement may be untunable, if you're lucky there may be a statistical
reason why the optimizer is choosing a bad path.

I think I would experiment with three approaches - cutting the first part
of the UNION out of the statement and setting up a framework with a couple
of numeric bind variables.
a) what happens if you force a nested loop instead of a hash join
b) what happens if you block unnesting (add no_unnest hint to the
connect-by subquery)
c) is there much change if you try the other connect-by hints in the
subquery.

You might also check the state of the i_sysauth1 index - the large number
CU gets might indicate that its much larger than it needs to be and is
causing a lot of excess work on the connect by pump with index full scan
(that's a long-shot, though).

Regards
Jonathan Lewis




On Thu, 29 Apr 2021 at 13:42, Willy Klotz <willyk@kbi-gmbh.de> wrote:

> Hi Jonathan,
>
>
>
> there are no queries in this test on the sysauth$ table.
>
>
>
> As I said: the only thing which is done in this test is one single =E2=80=
=9Cset
> role XXXX=E2=80=9D statement (this test is run with sqlplus). I assume th=
at =E2=80=9Cset
> role=E2=80=9D in turn does the =E2=80=9Cselect .. from sysauth$=E2=80=9D,=
 which runs for 26
> seconds.
>
>
>

--000000000000d7caa205c11db29b
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><br></div><div>I read your email, take an=
other look at what I said in mine:</div><div><br></div><div dir=3D"ltr">&gt=
;<br>
</div><div dir=3D"ltr">&gt; the 4 queries that (I assume) will have accesse=
d sysauth$ in your trace file.

</div><div>&gt;</div><div><br></div><div>The 4 queries that were in the tra=
ce file you generated (and the tkprof output you supplied) had the followin=
g SQL IDs</div><div><span style=3D"font-family:monospace">SQL ID: f8pj3d8v9=
wz1b Plan Hash: 3253291735<br>SQL ID: cjjjhss73p058 Plan Hash: 3316561731<b=
r>SQL ID: 9jbkynurzb23x Plan Hash: 2486390249<br>SQL ID: 5dqz0hqtp9fru Plan=
 Hash: 1435697754</span></div><div><br></div><div>None of them match the 4 =
that I listed from 19.3 in my previous post. Was this an instance running w=
ith the patch from 20.1 or an unpatched 19.8 ?</div><div>It is possible to =
apply an SQL Patch to sys-recursive SQL, but it&#39;s not really desirable,=
 but you could do some testing to see if you can find a better path for the=
 query.</div><div><br></div><div>I assume the table stats reasonable accura=
te and the problem is related to the number of privileges per role or the n=
umber of roles, or the number of roles per grantee. In short, something abo=
ut the pattern of roles and privileges is probably not one that Oracle expe=
cts, so if you&#39;re unlucky the statement may be untunable, if you&#39;re=
 lucky there may be a statistical reason why the optimizer is choosing a ba=
d path.</div><div><br></div><div>I think I would experiment with three appr=
oaches - cutting the first part of the UNION out of the statement and setti=
ng up a framework with a couple of numeric bind variables.</div><div>a) wha=
t happens if you force a nested loop instead of a hash join</div><div>b) wh=
at happens if you block unnesting (add no_unnest hint to the connect-by sub=
query)</div><div>c) is there much change if you try the other connect-by hi=
nts in the subquery.</div><div><br></div><div>You might also check the stat=
e of the i_sysauth1 index - the large number CU gets might indicate that it=
s much larger than it needs to be and is causing a lot of excess work on th=
e connect by pump with index full scan (that&#39;s a long-shot, though).<br=
></div><div><br></div><div>Regards</div><div>Jonathan Lewis</div><div><br><=
/div><br><div><br></div><div><br></div><div class=3D"gmail_quote"><div dir=
=3D"ltr" class=3D"gmail_attr">On Thu, 29 Apr 2021 at 13:42, Willy Klotz &lt=
;<a href=3D"mailto:willyk@kbi-gmbh.de" target=3D"_blank">willyk@kbi-gmbh.de=
</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:=
0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">=
<div lang=3D"DE"><div><p class=3D"MsoNormal"><span style=3D"font-size:11pt;=
font-family:&quot;Calibri&quot;,sans-serif;color:rgb(31,73,125)">Hi Jonatha=
n,<u></u><u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-size:=
11pt;font-family:&quot;Calibri&quot;,sans-serif;color:rgb(31,73,125)"><u></=
u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-size:1=
1pt;font-family:&quot;Calibri&quot;,sans-serif;color:rgb(31,73,125)" lang=
=3D"EN-GB">there are no queries in this test on the sysauth$ table.<u></u><=
u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-size:11pt;font-=
family:&quot;Calibri&quot;,sans-serif;color:rgb(31,73,125)" lang=3D"EN-GB">=
<u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-s=
ize:11pt;font-family:&quot;Calibri&quot;,sans-serif;color:rgb(31,73,125)" l=
ang=3D"EN-GB">As I said: the only thing which is done in this test is </spa=
n><span style=3D"font-size:11pt;font-family:&quot;Calibri&quot;,sans-serif;=
color:rgb(31,73,125)" lang=3D"EN-GB">one single =E2=80=9Cset role XXXX=E2=
=80=9D statement (this test is run with sqlplus). I assume that =E2=80=9Cse=
t role=E2=80=9D in turn does the =E2=80=9Cselect .. from sysauth$=E2=80=9D,=
 which runs for 26 seconds. <u></u><u></u></span></p><p class=3D"MsoNormal"=
><span style=3D"font-size:11pt;font-family:&quot;Calibri&quot;,sans-serif;c=
olor:rgb(31,73,125)" lang=3D"EN-GB">=C2=A0</span></p></div></div></blockquo=
te></div></div>

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


