Return-Path: <oracle-l-bounce@freelists.org>
X-Original-To: oracle-l@orafaq.com
Delivered-To: oracle-l@orafaq.com
Received: from puck1183.startdedicated.com (localhost [127.0.0.1])
 by puck1183.startdedicated.com (Postfix) with ESMTP id A51E21961471
 for <oracle-l@orafaq.com>; Thu,  2 Feb 2017 16:30:24 +0100 (CET)
Received: from turing.freelists.org (turing.freelists.org [206.53.239.180])
 by puck1183.startdedicated.com (Postfix) with ESMTPS
 for <oracle-l@orafaq.com>; Thu,  2 Feb 2017 16:30:24 +0100 (CET)
Received: from localhost (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 23F436C3F5;
 Thu,  2 Feb 2017 10:30:23 -0500 (EST)
X-Virus-Scanned: Debian amavisd-new 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 KrKzBykIKhjJ; Thu,  2 Feb 2017 10:30:23 -0500 (EST)
Received: from turing.freelists.org (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id B842F6C3B9;
 Thu,  2 Feb 2017 10:30:07 -0500 (EST)
Received: with ECARTIS (v1.0.0; list oracle-l); Thu, 02 Feb 2017 10:28:46 -0500 (EST)
Received: from localhost (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 9C6B56C274
 for <oracle-l@freelists.org>; Thu,  2 Feb 2017 10:28:45 -0500 (EST)
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 k5VJH97dRX6O for <oracle-l@freelists.org>;
 Thu,  2 Feb 2017 10:28:45 -0500 (EST)
Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0135.outbound.protection.outlook.com [104.47.40.135])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits))
 (No client certificate requested)
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 0264D6C24E
 for <oracle-l@freelists.org>; Thu,  2 Feb 2017 10:28:44 -0500 (EST)
Received: from DF4PR84MB0204.NAMPRD84.PROD.OUTLOOK.COM (10.162.193.146) by
 DF4PR84MB0201.NAMPRD84.PROD.OUTLOOK.COM (10.162.193.143) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id
 15.1.860.13; Thu, 2 Feb 2017 15:28:43 +0000
Received: from DF4PR84MB0204.NAMPRD84.PROD.OUTLOOK.COM ([10.162.193.146]) by
 DF4PR84MB0204.NAMPRD84.PROD.OUTLOOK.COM ([10.162.193.146]) with mapi id
 15.01.0860.026; Thu, 2 Feb 2017 15:28:43 +0000
From: "Powell, Mark" <mark.powell2@hpe.com>
To: Jonathan Lewis <jonathan@jlcomp.demon.co.uk>, "oracle-l@freelists.org"
 <oracle-l@freelists.org>, "jprem@outlook.com" <jprem@outlook.com>
Subject: Re: Tuning "INSERT as SELECT"
Thread-Topic: Tuning "INSERT as SELECT"
Date: Thu, 2 Feb 2017 15:28:43 +0000
Message-ID: <DF4PR84MB020445DA024CBE602818E80ACC4C0@DF4PR84MB0204.NAMPRD84.PROD.OUTLOOK.COM>
References: <TY1PR01MB0538F2C3A70674B77DBBC319BC4C0@TY1PR01MB0538.jpnprd01.prod.outlook.com>,<MMXP123MB0911F7009F1BED10AA6BAB08A54C0@MMXP123MB0911.GBRP123.PROD.OUTLOOK.COM>,<TY1PR01MB05389100D912B48FB267515ABC4C0@TY1PR01MB0538.jpnprd01.prod.outlook.com>
In-Reply-To: <TY1PR01MB05389100D912B48FB267515ABC4C0@TY1PR01MB0538.jpnprd01.prod.outlook.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: spf=none (sender IP is )
 smtp.mailfrom=mark.powell2@hpe.com; 
x-originating-ip: [15.203.233.77]
x-ms-office365-filtering-correlation-id: 7db0f5a8-72ad-476d-b7b7-08d44b802c45
x-ms-office365-filtering-ht: Tenant
x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(48565401081);SRVR:DF4PR84MB0201;
x-microsoft-exchange-diagnostics: 1;DF4PR84MB0201;7:fQbxJTzJP5ztFAqKDo8zvuxqzq3SD7BlRHNtUBhLDlgtuDGs5SonJBPF76lB51ac0lnQJF0w6r/CT204psmxp3PKUZ3R5RfCKJ7nbZ18sYhfrS/cjPnrPxneSS/atJSI5wLFglqybF7Ku5EqFDx6mE+W6X+uic9I1U0Eq6M802/J3HFkOxtrnfdQ0Hlvp2RrHKFkPZHlU0rui8Qg1ueBZQbwxlZ/LPRi9bTBf7mqmlxYWx6L0Wdqf+XbGNGs06a8POuvX4wv3ENhfB6VLJiqH4J2ZslNQdc1wOaRcZenDE8y8sXR9WxZOx+STHoiVxEwXvhb5kFMdMdcTc1Oigpa1V57BxdgqN5/+WrkvK5imY0XTU9d5T6zuMO8qDxKo614AtM7+3Zq3MipCMislJjuqvEwaeI2JznuFVx7kgymTVv8TpeOQqzIRoTOpjvfL43RmgQo0Ia8oNzpTTii6DiaKX1PQpSvHgbY3Z4GVc8Z4gBc/epV46JRdTStjWFuwdIyl5/ZEXLVaIIkFoW54S/mvq9cstH6NuvhD0IyzdN3QyE7b5UWdnkqa8QYSJSKMBx1
x-microsoft-antispam-prvs: <DF4PR84MB0201ECFEC2D378E3E992BF29CC4C0@DF4PR84MB0201.NAMPRD84.PROD.OUTLOOK.COM>
x-exchange-antispam-report-test: UriScan:(189930954265078);
x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123564025)(20161123558025)(20161123562025)(20161123560025)(20161123555025)(6072148);SRVR:DF4PR84MB0201;BCL:0;PCL:0;RULEID:;SRVR:DF4PR84MB0201;
x-forefront-prvs: 02065A9E77
x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(7916002)(39840400002)(39860400002)(39450400003)(39850400002)(39410400002)(377454003)(199003)(189002)(43784003)(9686003)(38730400001)(53936002)(7736002)(122556002)(54896002)(189998001)(2900100001)(74316002)(107886002)(3280700002)(2501003)(6436002)(77096006)(7696004)(55016002)(68736007)(5660300001)(6506006)(229853002)(2950100002)(92566002)(39060400001)(66066001)(6116002)(3660700001)(86362001)(2201001)(3846002)(33656002)(102836003)(106116001)(105586002)(101416001)(8676002)(5001770100001)(97736004)(50986999)(19627405001)(81166006)(81156014)(54356999)(76176999)(2906002)(106356001)(8936002);DIR:OUT;SFP:1102;SCL:1;SRVR:DF4PR84MB0201;H:DF4PR84MB0204.NAMPRD84.PROD.OUTLOOK.COM;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en;
received-spf: None (protection.outlook.com: hpe.com does not designate
 permitted sender hosts)
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
Content-Type: multipart/alternative;
 boundary="_000_DF4PR84MB020445DA024CBE602818E80ACC4C0DF4PR84MB0204NAMP_"
MIME-Version: 1.0
X-OriginatorOrg: hpe.com
X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Feb 2017 15:28:43.4664
 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR84MB0201
X-archive-position: 67556
X-ecartis-version: Ecartis v1.0.0
Sender: oracle-l-bounce@freelists.org
Errors-to: oracle-l-bounce@freelists.org
X-original-sender: mark.powell2@hpe.com
Precedence: normal
Reply-To: mark.powell2@hpe.com
List-help: <mailto:ecartis@freelists.org?Subject=help>
List-unsubscribe: <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: <oracle-l-request@freelists.org?Subject=subscribe>
List-owner: <mailto:mark.bobak@proquest.com>
List-post: <mailto:oracle-l@freelists.org>
List-archive: <http://www.freelists.org/archives/oracle-l>
X-list: oracle-l
--_000_DF4PR84MB020445DA024CBE602818E80ACC4C0DF4PR84MB0204NAMP_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Prem, "UNUSABLE" basically means one of the following 1- the index row entr=
ies no longer point to the correct location of the base table rows, the ind=
ex row entries point to non-existent rows, or there are table rows with no =
entry in the index when there should be an entry.  If you TRUNCATE the tabl=
e non of these conditions is true and on insert to the table the indexes wi=
ll be maintained so the indexes are USABLE, that is, the index entries are =
valid.

________________________________
From: oracle-l-bounce@freelists.org <oracle-l-bounce@freelists.org> on beha=
lf of Prem Khanna J <jprem@outlook.com>
Sent: Thursday, February 2, 2017 9:12:32 AM
To: Jonathan Lewis; oracle-l@freelists.org
Subject: Re: Tuning "INSERT as SELECT"


Hi Jonathan / Mladen / Tim and All - tons of thanks for your inputs.

>>Did you really select and fetch 80 million rows ?  or was it the first fe=
w, or a count(*) of an inline view, or what ?

You are on spot . we did a "select count(*) from inline view" :-(    Also t=
ested with "+all_rows" hint in sql*developer thinking that might help , but=
 now I feel like
that's also not the right way of testing as sql*developer stops with first =
50~100 rows. Will let the exact SQL run all the way in sql*plus and see lon=
g it takes.Just curious - is
there any other way of doing it (don't want to see all the 80m recs in sql*=
plus) or how would you guys do it ?

>> ... your test starts with a truncate then it will have made the indexes =
valid again.

Exaclty. we made indexes "unusable" , truncated the table before I ran my t=
ests. Did not imagine that truncate would my indexes valid. Just checked an=
d it was so.
Shocked !! Wonder why truncate does so. Thanks a million Jonathan for letti=
ng me know that.

>> please turn on SQL tracing using DBMS_MONITOR or .... Everything else is=
 pure witchcraft.
Sure Mladen. Thanks again for the valuable piece of advice.

Will continue with my tests and keep you guys posted.

Regards,
Prem


--_000_DF4PR84MB020445DA024CBE602818E80ACC4C0DF4PR84MB0204NAMP_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
<style type=3D"text/css" style=3D"display:none;"><!-- P {margin-top:0;margi=
n-bottom:0;} --></style>
</head>
<body dir=3D"ltr">
<style type=3D"text/css" style=3D"display:none;"><!-- P {margin-top:0;margi=
n-bottom:0;} --></style>
<div id=3D"divtagdefaultwrapper" style=3D"font-size:12pt;color:#000000;font=
-family:Calibri,Arial,Helvetica,sans-serif;" dir=3D"ltr">
<p>Prem, &quot;UNUSABLE&quot; basically means one of the following 1-&nbsp;=
the index row entries no longer point to the correct location of the base t=
able rows, the index row entries point to non-existent rows, or there are t=
able rows with no entry in the index when there
 should be an entry.&nbsp; If you TRUNCATE the table non of these condition=
s is true and on insert to the table the indexes will be maintained so the =
indexes are USABLE, that is, the index entries are valid.<br>
</p>
</div>
<hr style=3D"display:inline-block;width:98%" tabindex=3D"-1">
<div id=3D"divRplyFwdMsg" dir=3D"ltr"><font face=3D"Calibri, sans-serif" st=
yle=3D"font-size:11pt" color=3D"#000000"><b>From:</b> oracle-l-bounce@freel=
ists.org &lt;oracle-l-bounce@freelists.org&gt; on behalf of Prem Khanna J &=
lt;jprem@outlook.com&gt;<br>
<b>Sent:</b> Thursday, February 2, 2017 9:12:32 AM<br>
<b>To:</b> Jonathan Lewis; oracle-l@freelists.org<br>
<b>Subject:</b> Re: Tuning &quot;INSERT as SELECT&quot;</font>
<div>&nbsp;</div>
</div>
<div>
<div id=3D"divtagdefaultwrapper" style=3D"font-size:12pt;color:#000000;font=
-family:Calibri,Arial,Helvetica,sans-serif;" dir=3D"ltr">
<p></p>
<div>Hi Jonathan / Mladen / Tim and All - tons of thanks for your inputs.</=
div>
<div><br>
</div>
<div>&gt;&gt;Did you really select and fetch 80 million rows ? &nbsp;or was=
 it the first few, or a count(*) of an inline view, or what ?</div>
<div><br>
</div>
<div>You are on spot . we did a &quot;select count(*) from inline view&quot=
; :-( &nbsp; &nbsp;<span style=3D"font-size: 12pt;">Also tested with &quot;=
&#43;all_rows&quot; hint in sql*developer thinking that might
</span>help ,<span style=3D"font-size: 12pt;"> but now I feel </span>like&n=
bsp;</div>
<div>that's also not the right way of testing as sql*developer stops with f=
irst 50~100 rows. Will&nbsp;let<span style=3D"font-size: 12pt;"> the exact =
SQL run all the way in sql*plus and see long it takes.Just curious - is&nbs=
p;</span></div>
<div><span style=3D"font-size: 12pt;">there any </span>other&nbsp;way<span =
style=3D"font-size: 12pt;"> of doing it (don't want to see all the 80m recs=
 in sql*plus) or how would you guys do
</span>it ?</div>
<div><br>
</div>
<div>&gt;&gt; ... your test starts with a truncate then it will have made t=
he indexes valid again.</div>
<div><br>
</div>
<div>Exaclty. we made indexes &quot;unusable&quot; , truncated the table be=
fore I ran my tests. Did not imagine&nbsp;that<span style=3D"font-size: 12p=
t;"> truncate would my indexes valid. Just checked and it was so.&nbsp;</sp=
an></div>
<div><span style=3D"font-size: 12pt;">Shocked !! Wonder </span>why<span sty=
le=3D"font-size: 12pt;"> truncate does so.&nbsp;</span><span style=3D"font-=
size: 12pt;">Thanks a million Jonathan for letting me know that.&nbsp;</spa=
n></div>
<div><br>
</div>
<div>&gt;&gt; please turn on SQL tracing using DBMS_MONITOR or .... Everyth=
ing else is pure witchcraft.</div>
<div>Sure Mladen. Thanks again for the valuable piece of advice.</div>
<div><br>
</div>
<div>Will continue with my tests and keep you guys posted.</div>
<div><br>
</div>
<div>Regards,</div>
<div>Prem</div>
<p></p>
<div style=3D"color: rgb(0, 0, 0);"><font size=3D"2"><span style=3D"font-si=
ze:10pt;">
<div class=3D"PlainText"><br>
</div>
</span></font></div>
</div>
</div>
</body>
</html>

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


