Return-Path: <root@fatcity.cts.com>
Received: from newsfeed.cts.com (newsfeed.cts.com [209.68.248.164])
 by naude.co.za (8.11.2/8.11.2) with SMTP id g570Oet31354
 for <oracle-l@naude.co.za>; Thu, 6 Jun 2002 20:24:40 -0400
Received: from fatcity.UUCP (uucp@localhost)
 by newsfeed.cts.com (8.9.3/8.9.3) with UUCP id JAA46410;
 Thu, 6 Jun 2002 09:19:40 -0700 (PDT)
Received: by fatcity.com (26-Feb-2001/v1.0g-b71/bab) via UUCP id 004762D0; Thu, 06 Jun 2002 08:03:24 -0800
Message-ID: <F001.004762D0.20020606080324@fatcity.com>
Date: Thu, 06 Jun 2002 08:03:24 -0800
To: Multiple recipients of list ORACLE-L <ORACLE-L@fatcity.com>
X-Comment: Oracle RDBMS Community Forum
X-Sender: "Michael Rosenblum" <mrosenblum@dulcian.com>
Sender: root@fatcity.com
Reply-To: ORACLE-L@fatcity.com
Errors-To: ML-ERRORS@fatcity.com
From: "Michael Rosenblum" <mrosenblum@dulcian.com>
Subject: Re: Database link performance 
Organization: Fat City Network Services, San Diego, California
X-ListServer: v1.0g, build 71; ListGuru (c) 1996-2001 Bruce A. Bergman
Precedence: bulk
Mime-Version: 1.0
Content-Type: multipart/alternative;	boundary="----=_NextPart_000_0020_01C20D49.5A4EE9D0"
------=_NextPart_000_0020_01C20D49.5A4EE9D0
Content-Type: text/plain;
 charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hi, all!

 

Thanks for your help and suggestions.  Here is some feedback on what I
have found on  the performance problem of the querying data between two
databases using DB links.

 

To John Kanagaraj: filter by ROWNUM does not make any difference - I
have absolutely the same speed, when querying table with 5000 rows and
filtering 'where ROWNUM <5000'.

 

To Tom Mercadante: creating of a view, that does filtering, did not
help. Absolutely the same results!

 

Just remind you the case:

declare 

   v_record B%rowtype;

 

   cursor cB

   is

   select *

   from B@db_B.mycomp.com

   where rownum < 5000;

begin

   for c in cB

   loop

     v_record :=c;

   end loop;

end;

 

My next step has been to analyze session-level statistics.

 

When using link we have physically two sessions - from a client to db_A
(opened explicitly) and from db_A to db_B (opened by Oracle
automatically). After execution of a script: 
- in the session to db_A we have 10000 SQL*Net roundtrips to/from
db_link

- in the session to db_B we have 10000 SQL*Net roundtrips to/from
client.

 

But when I am running the same script directly (from client to db_B) -
there is only ONE SQL*Net roundtrip to/from the client.

 

I asked Paul Dorsey to check it out with Tom Kyte at yesterday's NYOUG
meeting.

 

Tom told us that Oracle 8.* does single record fetches when using
database links. In general, database links have been tuned to support
database replication. It means, that 'create table new_A as select .
from table_A@db_B' runs quickly but querying from new_A is quite slow.

 

The remaining question: has anybody tried to use database links in
Oracle9i? Does the same single fetch limitation apply?

 

Thank you,

Michael Rosenblum

Dulcian Inc.


------=_NextPart_000_0020_01C20D49.5A4EE9D0
Content-Type: text/html;
 charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<TITLE>Message</TITLE>

<META content=3D"MSHTML 5.50.4916.2300" name=3DGENERATOR></HEAD>
<BODY>
<DIV>
<DIV>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">Hi, =
all!<?xml:namespace prefix =3D=20
o ns =3D "urn:schemas-microsoft-com:office:office" /><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><o:p></o:p>&nbsp;</P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><o:p><SPAN=20
class=3D776004614-06062002>Thanks for your help and suggestions.&nbsp; =
Here is=20
some feedback on what I have found on </SPAN></o:p>&nbsp;the performance =
problem=20
of the querying data between t<SPAN class=3D776004614-06062002>w</SPAN>o =
databases=20
using DB links.<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><o:p>&nbsp;</o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">To John Kanagaraj: =
filter by=20
ROWNUM does not make any difference &#8211; I have absolutely the same =
speed, when=20
querying table with 5000 rows and filtering &#8216;where ROWNUM=20
&lt;5000&#8217;.<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><o:p>&nbsp;</o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">To Tom Mercadante: =
creating of a=20
view, that does filtering, did not help. Absolutely the same=20
results!<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><o:p>&nbsp;</o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><U>Just remind you =
the=20
case:<o:p></o:p></U></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">declare =
<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp; </SPAN>v_record =
B%rowtype;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp; </SPAN><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;</SPAN>cursor cB<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp; </SPAN>is<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp; </SPAN>select *<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp; </SPAN>from=20
B@db_B.mycomp.com<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp; </SPAN>where rownum &lt;=20
5000;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">begin<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp; </SPAN>for c in =
cB<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp; </SPAN>loop<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>v_record=20
:=3Dc;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp; </SPAN>end loop;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">end;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><o:p>&nbsp;</o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">My next step has been =
to analyze=20
session-level statistics.<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><o:p>&nbsp;</o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">When using link we =
have=20
physically two sessions &#8211; from a client to db_A (opened =
explicitly) and from=20
db_A to db_B (opened by Oracle automatically). After execution of a =
script:=20
<BR>- in the session to db_A we have 10000 SQL*Net roundtrips to/from=20
db_link<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">- in the session to =
db_B we have=20
10000 SQL*Net roundtrips to/from client.<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><o:p>&nbsp;</o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">But when I am running =
the same=20
script directly (from client to db_B) &#8211; there is only ONE SQL*Net =
roundtrip=20
to/from the client.<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><o:p>&nbsp;</o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">I asked Paul Dorsey =
to check it=20
out with Tom Kyte&nbsp;at yesterday&#8217;s NYOUG =
meeting.<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><o:p>&nbsp;</o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">Tom told us that =
Oracle 8.* does=20
single record fetches when using database links. In general, database =
links have=20
been tuned to support database replication. It means, that &#8216;create =
table new_A=20
as select &#8230; from table_A@db_B&#8217; runs quickly but querying =
from new_A is quite=20
slow.<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><o:p>&nbsp;</o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">The remaining =
question: has=20
anybody tried to use database links in Oracle9i? Does the same single =
fetch=20
limitation apply?<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><o:p>&nbsp;</o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">Thank =
you,<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">Michael =
Rosenblum<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">Dulcian=20
Inc.<o:p></o:p></P></DIV></DIV></BODY></HTML>

------=_NextPart_000_0020_01C20D49.5A4EE9D0--


-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Michael Rosenblum
  INET: mrosenblum@dulcian.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru@fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

