<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Distributed DML</title>
	<atom:link href="http://jonathanlewis.wordpress.com/2008/12/05/distributed-dml/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com/2008/12/05/distributed-dml/</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Sat, 18 May 2013 11:04:10 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Hass Khan</title>
		<link>http://jonathanlewis.wordpress.com/2008/12/05/distributed-dml/#comment-49865</link>
		<dc:creator><![CDATA[Hass Khan]]></dc:creator>
		<pubDate>Wed, 05 Sep 2012 05:19:11 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=809#comment-49865</guid>
		<description><![CDATA[Andras Gabor  ...Thank you for the wonderful comment . By bulk collecting the select into an array and then inserting forall works perfectly .]]></description>
		<content:encoded><![CDATA[<p>Andras Gabor  &#8230;Thank you for the wonderful comment . By bulk collecting the select into an array and then inserting forall works perfectly .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Distributed Queries &#8211; 2 &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2008/12/05/distributed-dml/#comment-37870</link>
		<dc:creator><![CDATA[Distributed Queries &#8211; 2 &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Wed, 24 Nov 2010 10:12:09 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=809#comment-37870</guid>
		<description><![CDATA[[...] consequence the driving site for a distributed query will be the local database unless you use the /*+ driving_site */ hint to change [...]]]></description>
		<content:encoded><![CDATA[<p>[...] consequence the driving site for a distributed query will be the local database unless you use the /*+ driving_site */ hint to change [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Distributed Pipelines &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2008/12/05/distributed-dml/#comment-37493</link>
		<dc:creator><![CDATA[Distributed Pipelines &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Thu, 07 Oct 2010 18:08:57 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=809#comment-37493</guid>
		<description><![CDATA[[...] an article that I wrote about the /*+ driving_site */ hint a few months ago I pointed out that the hint was not supposed to work with &#8220;create table as [...]]]></description>
		<content:encoded><![CDATA[<p>[...] an article that I wrote about the /*+ driving_site */ hint a few months ago I pointed out that the hint was not supposed to work with &#8220;create table as [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ignoring Hints &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2008/12/05/distributed-dml/#comment-36273</link>
		<dc:creator><![CDATA[Ignoring Hints &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Wed, 19 May 2010 21:05:44 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=809#comment-36273</guid>
		<description><![CDATA[[...] Jonathan Lewis @ 9:04 pm UTC May 19,2010   I&#8217;ve previously published a couple of notes (here and here) about the driving_site() hint. The first note pointed out that the hint was deliberately [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Jonathan Lewis @ 9:04 pm UTC May 19,2010   I&#8217;ve previously published a couple of notes (here and here) about the driving_site() hint. The first note pointed out that the hint was deliberately [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Distributed Queries &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2008/12/05/distributed-dml/#comment-33786</link>
		<dc:creator><![CDATA[Distributed Queries &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Sun, 05 Jul 2009 06:11:31 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=809#comment-33786</guid>
		<description><![CDATA[[...] Execution plans, Hints &#8212; Jonathan Lewis @ 7:20 am UTC Jul 1,2009   Some time ago I wrote a note about distributed DML, pointing out that the driving_site() hint works with distributed queries but not with distributed [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Execution plans, Hints &#8212; Jonathan Lewis @ 7:20 am UTC Jul 1,2009   Some time ago I wrote a note about distributed DML, pointing out that the driving_site() hint works with distributed queries but not with distributed [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jiri</title>
		<link>http://jonathanlewis.wordpress.com/2008/12/05/distributed-dml/#comment-32542</link>
		<dc:creator><![CDATA[jiri]]></dc:creator>
		<pubDate>Tue, 13 Jan 2009 23:40:09 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=809#comment-32542</guid>
		<description><![CDATA[just to add to Andras ... yeah I use the same approach BULK COLLECT, I use FORALL and commit after X number of rows (one large insert can eat a lot of memory - even 1GB+ !!) - but of course cannot be simply rollbacked. I have whole thing is as EXECUTE IMMEDIATE (which allows to adjust hints on a fly) in one stored procedure with detail logging about number of rows inserted... works like a charm even for 100mm+ inserts.

:-)


I tried to use pipelined functions but although it can speed up a lot the whole insert, pipeline functions do not like (if I can use that word) db-limk in parallel. When I ran the inserts in single server, I noticed good improvement, but it went all away with db-link iserts (the main point of this).]]></description>
		<content:encoded><![CDATA[<p>just to add to Andras &#8230; yeah I use the same approach BULK COLLECT, I use FORALL and commit after X number of rows (one large insert can eat a lot of memory &#8211; even 1GB+ !!) &#8211; but of course cannot be simply rollbacked. I have whole thing is as EXECUTE IMMEDIATE (which allows to adjust hints on a fly) in one stored procedure with detail logging about number of rows inserted&#8230; works like a charm even for 100mm+ inserts.</p>
<p>:-)</p>
<p>I tried to use pipelined functions but although it can speed up a lot the whole insert, pipeline functions do not like (if I can use that word) db-limk in parallel. When I ran the inserts in single server, I noticed good improvement, but it went all away with db-link iserts (the main point of this).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pete Scott</title>
		<link>http://jonathanlewis.wordpress.com/2008/12/05/distributed-dml/#comment-32382</link>
		<dc:creator><![CDATA[Pete Scott]]></dc:creator>
		<pubDate>Wed, 10 Dec 2008 17:31:49 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=809#comment-32382</guid>
		<description><![CDATA[Very timely for me - I am reviewing a data warehouse where a lot of the ETL is built around joins running on remote (source) machines. Coupled with the explain plans I captured and this blog piece I have convinced the customer that they need to rethink how they do this part of their batch process.

I suspect that they (in the long distant past) gave these these troublesome distributed queries to a DBA to tune, and then wrapped the tuned select statements with the insert into and did not notice the change in plan.]]></description>
		<content:encoded><![CDATA[<p>Very timely for me &#8211; I am reviewing a data warehouse where a lot of the ETL is built around joins running on remote (source) machines. Coupled with the explain plans I captured and this blog piece I have convinced the customer that they need to rethink how they do this part of their batch process.</p>
<p>I suspect that they (in the long distant past) gave these these troublesome distributed queries to a DBA to tune, and then wrapped the tuned select statements with the insert into and did not notice the change in plan.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2008/12/05/distributed-dml/#comment-32374</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Mon, 08 Dec 2008 21:11:47 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=809#comment-32374</guid>
		<description><![CDATA[Gary,

I think your final comment about &quot;careful weighing up&quot; applies to all cases of distributed queries and transactions.

I recall cases in earlier versions of Oracle where I could run a (long) distributed nested loop join, and get inconsistent results by changing the data at the remote table as the nested loop was running.

I&#039;m not sure that your example would be an more problematic than not creating the view, by the way - but I&#039;d want to check it before I committed myself. 

If you have links that double back like this, I think that (recent versions of) Oracle may detect what&#039;s going on and make the queries tightly-coupled branches of the same transaction.  (This wouldn&#039;t handle the VPD / sys_context features necessarily, but they&#039;re likely to behave in unexpected ways anyway)]]></description>
		<content:encoded><![CDATA[<p>Gary,</p>
<p>I think your final comment about &#8220;careful weighing up&#8221; applies to all cases of distributed queries and transactions.</p>
<p>I recall cases in earlier versions of Oracle where I could run a (long) distributed nested loop join, and get inconsistent results by changing the data at the remote table as the nested loop was running.</p>
<p>I&#8217;m not sure that your example would be an more problematic than not creating the view, by the way &#8211; but I&#8217;d want to check it before I committed myself. </p>
<p>If you have links that double back like this, I think that (recent versions of) Oracle may detect what&#8217;s going on and make the queries tightly-coupled branches of the same transaction.  (This wouldn&#8217;t handle the VPD / sys_context features necessarily, but they&#8217;re likely to behave in unexpected ways anyway)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gary</title>
		<link>http://jonathanlewis.wordpress.com/2008/12/05/distributed-dml/#comment-32370</link>
		<dc:creator><![CDATA[gary]]></dc:creator>
		<pubDate>Mon, 08 Dec 2008 04:01:16 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=809#comment-32370</guid>
		<description><![CDATA[Hi Chris,
I agree that it is an implementation restriction. I don&#039;t think there&#039;s any theoretical reason why it can&#039;t be done. But equally I can see that some-one may look at the existing code and try to work out what needs to be done in terms of read and write consistency, locking, mutating tables, deferrable constraints, multi-table inserts, logging DML exceptions, backwards compatibility, trace, audit etc, and decide its not worth the trouble.

Jonathan&#039;s footnote &quot;you’ll have to create a join view at the remote site&quot; needs careful weighing up.
You create db_link &quot;ab&quot; to go from &quot;a&quot; to &quot;b&quot; and &quot;ba&quot; to go from &quot;b&quot; back to &quot;a&quot;. 
In &quot;a&quot; your &quot;session 1&quot; does a &quot;select * from x@ab&quot;. In &quot;b&quot;, &quot;x&quot; is a synonym for &quot;y@ba&quot;. The actual result from object &quot;y&quot; will be from a separate database session than your original &quot;session 1&quot;. It won&#039;t see any of session 1&#039;s uncommitted changes to the table and may have a different isolation level, sys_context values (VPD), roles enabled, package state...]]></description>
		<content:encoded><![CDATA[<p>Hi Chris,<br />
I agree that it is an implementation restriction. I don&#8217;t think there&#8217;s any theoretical reason why it can&#8217;t be done. But equally I can see that some-one may look at the existing code and try to work out what needs to be done in terms of read and write consistency, locking, mutating tables, deferrable constraints, multi-table inserts, logging DML exceptions, backwards compatibility, trace, audit etc, and decide its not worth the trouble.</p>
<p>Jonathan&#8217;s footnote &#8220;you’ll have to create a join view at the remote site&#8221; needs careful weighing up.<br />
You create db_link &#8220;ab&#8221; to go from &#8220;a&#8221; to &#8220;b&#8221; and &#8220;ba&#8221; to go from &#8220;b&#8221; back to &#8220;a&#8221;.<br />
In &#8220;a&#8221; your &#8220;session 1&#8243; does a &#8220;select * from x@ab&#8221;. In &#8220;b&#8221;, &#8220;x&#8221; is a synonym for &#8220;y@ba&#8221;. The actual result from object &#8220;y&#8221; will be from a separate database session than your original &#8220;session 1&#8243;. It won&#8217;t see any of session 1&#8242;s uncommitted changes to the table and may have a different isolation level, sys_context values (VPD), roles enabled, package state&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian Antognini</title>
		<link>http://jonathanlewis.wordpress.com/2008/12/05/distributed-dml/#comment-32369</link>
		<dc:creator><![CDATA[Christian Antognini]]></dc:creator>
		<pubDate>Sun, 07 Dec 2008 22:41:17 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=809#comment-32369</guid>
		<description><![CDATA[Hi Gary

&gt; I think they mean that the db where the data is being changed
&gt; must be the “master”/”driving site”.

Yes, this is my understanding as well. But, as I wrote, it does not make sense... or, at least, it could be different ;-)

In the documentation is written &quot;The DRIVING_SITE hint instructs the optimizer to execute the query at a different site than that selected by the database. This hint is useful if you are using distributed query optimization.&quot;

My point is that the DRIVING_SITE hint should not apply to the DML part of a statement but only (as the documentation says) to the query. In a CTAS or INSERT SELECT statement that would mean that the driving site might be on a different databases than the target database (where data is inserted/updated/deleted). 

Honestly, I do not see a technical reason why that should not be possible. Take, for example, a plain query executed remotely for which the remote database is also the driving site. Where is sent the output data? Locally. So, why it should not be possible to write that data into a local table instead than sending it back to a client? Once again, I do not see why that should not be possible. Hence, this is an implementation restriction...

Cheers,
Chris]]></description>
		<content:encoded><![CDATA[<p>Hi Gary</p>
<p>&gt; I think they mean that the db where the data is being changed<br />
&gt; must be the “master”/”driving site”.</p>
<p>Yes, this is my understanding as well. But, as I wrote, it does not make sense&#8230; or, at least, it could be different ;-)</p>
<p>In the documentation is written &#8220;The DRIVING_SITE hint instructs the optimizer to execute the query at a different site than that selected by the database. This hint is useful if you are using distributed query optimization.&#8221;</p>
<p>My point is that the DRIVING_SITE hint should not apply to the DML part of a statement but only (as the documentation says) to the query. In a CTAS or INSERT SELECT statement that would mean that the driving site might be on a different databases than the target database (where data is inserted/updated/deleted). </p>
<p>Honestly, I do not see a technical reason why that should not be possible. Take, for example, a plain query executed remotely for which the remote database is also the driving site. Where is sent the output data? Locally. So, why it should not be possible to write that data into a local table instead than sending it back to a client? Once again, I do not see why that should not be possible. Hence, this is an implementation restriction&#8230;</p>
<p>Cheers,<br />
Chris</p>
]]></content:encoded>
	</item>
</channel>
</rss>
