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 A66A4100320F50
 for <oracle-l@orafaq.com>; Thu,  2 Feb 2023 16:22:34 +0100 (CET)
Received: from turing.freelists.org (turing [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 C6FF540935;
 Thu,  2 Feb 2023 15:22:33 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by turing.freelists.org (Postfix) with ESMTP id 999F0403AC;
 Thu,  2 Feb 2023 15:22:33 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=freelists.org;
 s=turing; t=1675351353;
 bh=lREhLTJvQbC5pe9Oo1l9PE/OuSrC5U0siq9LQ8y+BGQ=;
 h=From:Sender:Sender:From;
 b=pd9wD1/DJH163hdPCL7PXp0UiEBLPGkhH96T+SUgim5Ca1tPSo75pN4lnCvdklX7S
	 sT05yxRqMKSZRL6CQmk8NhS6LX4ZFm1dFRo1SrtBQjlfnyoJPhFugPwwrKnNUmt3Gl
	 7Yea/hhrKNl0ijy3ircxEvVhb23e1RsCUDswL8tA=
X-Virus-Scanned: by FreeLists at turing.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 LpIgvlpteYoZ; Thu,  2 Feb 2023 15:22:33 +0000 (UTC)
Received: from turing.freelists.org (localhost [127.0.0.1])
 by turing.freelists.org (Postfix) with ESMTP id 9371646C56;
 Thu,  2 Feb 2023 15:21:47 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=freelists.org;
 s=turing; t=1675351351;
 bh=lREhLTJvQbC5pe9Oo1l9PE/OuSrC5U0siq9LQ8y+BGQ=;
 h=From:Sender:Sender:From;
 b=BeyNOlAMFE60XgI0qqFfB1fe+sAMCfBLqL1Pz108p2Nw6ZXzm0E1EnwPUgFVF6bCp
	 BIbFq1ib84yLBYr1y21+MTyxe/k/2rFALDAEp9tym4UexL7QhT/LoCvaEaBIbRIOk6
	 xyQOCe5/jf8aegG9tO1zGraFMuZHlKl+VjObBjWM=
Received: with ECARTIS (v1.0.0; list oracle-l); Thu, 02 Feb 2023 15:21:02 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by turing.freelists.org (Postfix) with ESMTP id 8F7CB46C4C
 for <oracle-l@freelists.org>; Thu,  2 Feb 2023 15:21:02 +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=20210112 header.b=hW68z/A1;
 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 zqEUrSBWQ8cI for <oracle-l@freelists.org>;
 Thu,  2 Feb 2023 15:21:02 +0000 (UTC)
Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49])
 (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 6497940305
 for <oracle-l@freelists.org>; Thu,  2 Feb 2023 15:21:02 +0000 (UTC)
Received: by mail-lf1-f49.google.com with SMTP id br9so3460551lfb.4
        for <oracle-l@freelists.org>; Thu, 02 Feb 2023 07:21:02 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20210112;
        h=to:subject:message-id:date:from:in-reply-to:references:mime-version
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
        bh=SCoEzyl+HmHd6k4aSE8Vcsa0X3FTews1xACW4QLHgt0=;
        b=DV1BgPQv0SC6JqH75h33mpvBc8GINEhLf0y08fCm6e59YQN31Ofl1cCAp9HmNFHT5u
         0SExToOayETSkz3ddF8tXTmCWqP61SzPslLRXtPnr9NvWqS4VDDmjesG6F6iuV2xt0cq
         OyFxjdTg2UzetNMriogbeLl/OaGGFgTt2AxQVW8gNDrxuQQyb2s9pVB/G+TOodkDv8Bd
         6EyEarcdZLx7X3nkh4ZimnLJWRDVa1q8t402dTY7BimBANEFfq3zbDA2cJF6EhiLKXJJ
         tEGhFluM8AxhJi309QlBCF8LNMYd6iHELuGh2AaJeVpsZsTKYVqzxej0BjobcsHnNRaU
         w8Zg==
X-Gm-Message-State: AO0yUKU1SnMXW76KxnE88FhfDp4KBhSYPkKojbff/MH+xM6IOfmqjKbo
 H56WWIAEvCH8427JHp/fm/wj8RzLLRhKUvgcfWrWzgtS4Ls=
X-Google-Smtp-Source: AK7set8D952WqMDXe3ZhugNP2s/279lrxqmUkj7ed4WMI89YQREAeYGMFGaOnmvN1sQbhb3Jpen4LYrz8JnpJR8w9MM=
X-Received: by 2002:a05:6512:74d:b0:4d7:aeb6:2ef8 with SMTP id
 c13-20020a056512074d00b004d7aeb62ef8mr1153877lfs.246.1675351260990; Thu, 02
 Feb 2023 07:21:00 -0800 (PST)
MIME-Version: 1.0
References: <CAEjw_fg4AURJOGnCvnjgicYo9AKCVumsExhNzQXwVVKd90atNw@mail.gmail.com>
 <ac49f9c6-2af0-a3d3-4edc-9b8f1d1ed4f8@gmail.com> <CAEjw_fhr2unENrwAVAbJ-JuinaVUUdHOKjYH3bHcLtOrvUAFdA@mail.gmail.com>
 <CAGtsp8mqnZDNmq4AoMRG51bcC1CtW=cerbkd0y2vCWJSdYbw-A@mail.gmail.com>
 <CAEjw_fgVNvEgoXWdSNqxtuVar-8aRVbhKLmg5cqdz8u7kzvHWQ@mail.gmail.com>
 <CAGtsp8kk0rWjDFRyDOVb2vAGTvThd4bmHjaKVK8_ZC-C3UughA@mail.gmail.com>
 <CAEjw_fiiM7kw35t_m9N7m1Z6uV1cjpBG2H6p9Ba_imqS5T8LEg@mail.gmail.com>
 <CAGtsp8ky0tM3NTJavzYg=WRTDN-o=zx+BFSy0Q1hMZvJ5Tzstg@mail.gmail.com>
 <CAEjw_fjqVicN+EKr5DKZg9cWE-rbCFhegOjALgdz=OHegXJiXw@mail.gmail.com>
 <CAGtsp8=LFT8zKedFtGcGGipYnLKO4tCRHH8iuBx4wxi9xtX9Yw@mail.gmail.com>
 <CAEjw_fj_LSUQJZqS5AxyKcu_NZbiADoCP4VmPmn61axfemFM7Q@mail.gmail.com>
 <CAEjw_fi5crY6DPiTFOn7LYoRrzLEbehggm6RW-eUTB4dBQ1DQQ@mail.gmail.com>
 <CAEzWdqe8hZT+6SGJsdkwSt337FuScfGrFiuV6fXt=7U0ViPDyg@mail.gmail.com>
 <CAEjw_fgxeHwU05222ESKWYYmUWcj8YRHZTvGe6sR62hey7_TuQ@mail.gmail.com>
 <5f0001d934cc$2ec38ac0$8c4aa040$@rsiz.com> <CAEjw_fhyoCR5EWyMD_vcUPsi-EWRA90csCkdkgG=RhT4aA6cPQ@mail.gmail.com>
 <CAGtsp8k5Bq8gBP1r0R2QSx4k2Y+g69hBpHtHF6EbVFZr8cYzeA@mail.gmail.com> <CAEzWdqewVt7aJDcGBAqqqCdX+D66V_6Xrz8vDAiLZWV=+vb1Tg@mail.gmail.com>
In-Reply-To: <CAEzWdqewVt7aJDcGBAqqqCdX+D66V_6Xrz8vDAiLZWV=+vb1Tg@mail.gmail.com>
From: Jonathan Lewis <jlewisoracle@gmail.com>
Date: Thu, 2 Feb 2023 15:20:46 +0000
Message-ID: <CAGtsp8mL+Ug7cqbnduwMtSfEgUCsHAk5ZOGf_B3qN2ekb77Zvg@mail.gmail.com>
Subject: Re: Unique index access path seems very slow
To: Oracle L <oracle-l@freelists.org>
Content-Type: multipart/alternative; boundary="000000000000c90ec905f3b91c45"
X-archive-position: 83512
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
--000000000000c90ec905f3b91c45
Content-Type: text/plain; charset="UTF-8"

Yuhdi,

As I pointed out, I don't think that there's likely to be *much* change in
performance by hacking in a different cardinality estimates; but we have
seen that the two different figures produce significant changes in WHERE
the time is spent and some change in the effectiveness of off-loading.
Given that clue (and assuming that there isn't a more important task to
address) I would have spent an hour or two re-running the query with a few
different cardinality hints between 49K and 2M to see if there was a sweet
spot that reduced the CPU required to apply the filter, maximised the
effectiveness of offloading, and minimised the number of rows passed up the
plan.

IIRC none of the plans showed any writes on the hash join, so I wasn't
thinking about overheads of hash joins spilling to disk.

The suggestion for re-engineering the data so that Oracle could iterate
through a partition-wise join was also about offload and CPU efficiency. On
smaller data volumes a hash table could have both a smaller number of
buckets and be more accurate in its distribution, so a Bloom filter could
be more effective and cheaper to use on the offload.

The switch to RAW, of course, is mostly about reducing I/O:  the very slow
runs are probably about resource use by other users on the Cell Servers so
a smaler data size means less I/O which means less impact when the hardware
gets busy; it did occur to me to wonder if the CPU cost of hashing a 64
byte raw would be less than the cost of hashing a 128 byte varchar (answer:
probably) which would also reduce run time and the load on the cell server
(and that last one woudl reduce the risk of large volumes of data being
sent unprocessed to the database server).



Regards
Jonathan Lewis




On Tue, 31 Jan 2023 at 19:54, yudhi s <learnerdatabase99@gmail.com> wrote:

> So Jonathan, OP has supplied plans which shows both cases, I. E, with
> large estimation the bigger bloom filter is consuming additional CPU cycle
> and with smaller estimation the hash join is consuming higher CPU cycle.
> But both the cases the total query execution time is closely equal, also op
> mentioned both the plans running for ~30minutes+ many times of the day
> so...
>
> when you said below I. E favoring large bloom filter option, so I am
> wondering if it's because it might help in less temp spill? Or say, do you
> mean its better option of hinting the inline view or tran_tab estimation
> very high so that a bigger bloom filter will be applied and the lesser
> amounts of rows will be passed to the hash join which may also benefit in
> case of large data volume as temp spill will be minimal?
>
> *Note that the Offload Returned Bytes was 300GB for the 49K estimate with
> the small Bloom filter, and 500GB for the 2M estimate with the large Bloom
> filter.*
> *It looks like we need to "fake" the system so that the Bloom filter
> (estimate) is large enough to eliminate a lot of data while being small
> enough to be sent to the cell server so that the 14 concurrently active
> cells can do the row elimination.  Beyond that I don't think there's a way
> to make the query go faster than the (roughly) 650 seconds you've seen so
> far*.
>
>
> On Tue, 31 Jan, 2023, 3:51 am Jonathan Lewis, <jlewisoracle@gmail.com>
> wrote:
>
>> Comparing the 5 hash join plans you've posted:
>>
>>

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

<div dir=3D"ltr"><div dir=3D"ltr"><br></div><div>Yuhdi,</div><div><br></div=
><div>As I pointed out, I don&#39;t think that there&#39;s likely to be <i>=
<b>much</b></i> change in performance by hacking in a different cardinality=
 estimates; but we have seen that the two different figures produce signifi=
cant changes in WHERE the time is spent and some change in the effectivenes=
s of off-loading.=C2=A0 Given that clue (and assuming that there isn&#39;t =
a more important task to address) I would have spent an hour or two re-runn=
ing the query with a few different cardinality hints between 49K and 2M to =
see if there was a sweet spot that reduced the CPU required to apply the fi=
lter, maximised the effectiveness of offloading, and minimised the number o=
f rows passed up the plan.</div><div><br></div><div>IIRC none of the plans =
showed any writes on the hash join, so I wasn&#39;t thinking about overhead=
s of hash joins spilling to disk.</div><div><br></div><div>The suggestion f=
or re-engineering the data so that Oracle could iterate through a partition=
-wise join was also about offload and CPU efficiency. On smaller data volum=
es a hash table could have both a smaller number of buckets and be more acc=
urate in its distribution, so a Bloom filter could be more effective and ch=
eaper to use on the offload.<br></div><div><br></div><div>The switch to RAW=
, of course, is mostly about reducing I/O:=C2=A0 the very slow runs are pro=
bably about resource use by other users on the Cell Servers so a smaler dat=
a size means less I/O which means less impact when the hardware gets busy; =
it did occur to me to wonder if the CPU cost of hashing a 64 byte raw would=
 be less than the cost of hashing a 128 byte varchar (answer: probably) whi=
ch would also reduce run time and the load on the cell server (and that las=
t one woudl reduce the risk of large volumes of data being sent unprocessed=
 to the database server).</div><div><br></div><div><br></div><div><br></div=
><div>Regards</div><div>Jonathan Lewis</div><div><br></div><div><br></div><=
div><br></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmai=
l_attr">On Tue, 31 Jan 2023 at 19:54, yudhi s &lt;<a href=3D"mailto:learner=
database99@gmail.com">learnerdatabase99@gmail.com</a>&gt; wrote:<br></div><=
blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l=
eft:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"auto"><div>So =
Jonathan, OP has supplied plans which shows both cases, I. E, with large es=
timation the bigger bloom filter is consuming additional CPU cycle and with=
 smaller estimation the hash join is consuming higher CPU cycle. But both t=
he cases the total query execution time is closely equal, also op mentioned=
 both the plans running for ~30minutes+ many times of the day so...=C2=A0<d=
iv dir=3D"auto"><br></div><div dir=3D"auto">when you said below I. E favori=
ng large bloom filter option, so I am wondering if it&#39;s because it migh=
t help in less temp spill? Or say, do you mean its better option of hinting=
 the inline view or tran_tab estimation very high so that a bigger bloom fi=
lter will be applied and the lesser amounts of rows will be passed to the h=
ash join which may also benefit in case of large data volume as temp spill =
will be minimal?=C2=A0<div dir=3D"auto"><br></div><div dir=3D"auto"><div st=
yle=3D"font-size:12.8px" dir=3D"auto"><i>Note that the Offload Returned Byt=
es was 300GB for the 49K estimate with the small Bloom filter, and 500GB fo=
r the 2M estimate with the large Bloom filter.</i></div><div style=3D"font-=
size:12.8px" dir=3D"auto"><i>It looks like we need to &quot;fake&quot; the =
system so that the Bloom filter (estimate) is large enough to eliminate a l=
ot of data while being small enough to be sent to the cell server so that t=
he 14 concurrently active cells can do the row elimination.=C2=A0 Beyond th=
at I don&#39;t think there&#39;s a way to make the query go faster than the=
 (roughly) 650 seconds you&#39;ve seen so far</i>.</div></div></div><br><br=
><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Tue, 3=
1 Jan, 2023, 3:51 am Jonathan Lewis, &lt;<a href=3D"mailto:jlewisoracle@gma=
il.com" target=3D"_blank">jlewisoracle@gmail.com</a>&gt; wrote:<br></div><b=
lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le=
ft:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div dir=
=3D"ltr"><div>Comparing the 5 hash join plans you&#39;ve posted:</div><br><=
blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l=
eft:1px solid rgb(204,204,204);padding-left:1ex">
</blockquote></div></div>
</blockquote></div></div></div>
</blockquote></div></div>

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


