Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Remote Joins cause poor response times

Re: Remote Joins cause poor response times

From: Scott Watson <swatson_at_datachest.com>
Date: Wed, 25 Apr 2001 13:06:33 GMT
Message-ID: <tZzF6.637517$f36.18373576@news20.bellglobal.com>

Mark, thanks for the answer....

However attached is two statements with plans. I would like to know why when I don't select any columns from the remote table the other column (from explain plan) shows the query I would have hoped was sent to the remote server, but when I include columns it does not.

Thanks,
Scott.

explain plan
set statement_id = 'SCOTT1' for
Select /*+ ordered */ DE.SFID, DE.VERSION_TOKEN, N.NAME_DESCRIPTION, Get_Translated_Text(1, N.SYN_TOKEN,'SYNONYM_TYPES.SYN_TYPE')  from QUERY_OL_DATA_ELEMENTS DE, OL_SUBST_NAMES N where DE.QUERY_SUMMARY_NO = 8476 and N.USID = DE.USID AND N.LANG_TOKEN = 1;

Execution Plan
OTHER




SELECT STATEMENT CHOOSE Cost=235 Rows=7264 Bytes=849888   HASH JOIN Cost=235 Rows=7264 Bytes=849888     TABLE ACCESS (BY INDEX ROWID) DATACHEST.QUERY_OL_DATA_ELEMENTS(1) ANALYZED Cost=20 Rows=522 Byte
s=27144

      INDEX (RANGE SCAN) DATACHEST.QRY_OL_DATA_ELEMENTS_PK ANALYZED Cost=3 Rows=522

    PROD SERIAL_FROM_REMOTE Cost=206 Rows=2018033 Bytes=131172145 SELECT "USID","LANG_T OKEN","SYN_TOKEN","NA ME_DESCRIPTION" FROM "OL_SUBST_NAMES" "N" WHERE "LANG_TOKEN"=1 explain plan
set statement_id = 'SCOTT2' for
Select /*+ ordered */ DE.SFID, DE.VERSION_TOKEN  from QUERY_OL_DATA_ELEMENTS DE, OL_SUBST_NAMES N where DE.QUERY_SUMMARY_NO = 8476 and N.USID = DE.USID AND N.LANG_TOKEN = 1;

Execution Plan
OTHER




SELECT STATEMENT CHOOSE Cost=20 Rows=7264 Bytes=566592   NESTED LOOPS Cost=20 Rows=7264 Bytes=566592     TABLE ACCESS (BY INDEX ROWID) DATACHEST.QUERY_OL_DATA_ELEMENTS(1) ANALYZED Cost=20 Rows=522 Byte
s=27144

      INDEX (RANGE SCAN) DATACHEST.QRY_OL_DATA_ELEMENTS_PK ANALYZED Cost=3 Rows=522

    PROD SERIAL_FROM_REMOTE Rows=2018033 Bytes=52468858 SELECT "USID","LANG_T OKEN" FROM "OL_SUBST_ NAMES" "N" WHERE "USI D"=:1 AND "LANG_TOKEN "=1

<xmark.powell_at_eds.com.x> wrote in message news:9c40e1$sm$1_at_news.netmar.com...
> In article <Iy1F6.716878$JT5.19090605_at_news20.bellglobal.com>, Scott Watson
> <swatson_at_datachest.com> writes:
> >
> >
> >Is there a more efficient way to get oracle to work with remote joins.
 My
> >query is selecting data form the local table using the primary key (good)
> >and using the returned values to join on the remote table using colums of
 a
> >selective index over on the remote side. My problem is I have no idea
 how
> >Oracle is handling the join the card and byte values are extremely high
 as
> >opposed to when I issue the select alone.
> >
> >Here is the little monster (the remote table is OL_SUBST_NAME)
> >order of the tables does not make a difference so driving table is not an
> >issue
> >the function call has been ruled out ast the culprit as well.
> >
> > Select DISTINCT DE.SFID, DE.VERSION_TOKEN,
> > N.NAME_DESCRIPTION,
> > Get_Translated_Text(1, N.SYN_TOKEN,'SYNONYM_TYPES.SYN_TYPE')
> > from OL_SUBST_NAMES N,
> > QUERY_OL_DATA_ELEMENTS DE
> > where DE.QUERY_SUMMARY_NO = 8476 and N.USID = DE.USID AND N.LANG_TOKEN
 =
> >1
> >
> >If I were to execute
> >select a,b,c
> > from OL_SUBST_NAMES
> >where usid in (x,y,z)
> > and lang_token = 1
> >
> >the results come back very fast but when used in the query above with a
 join
> >as I said it is very slow.
> >
> >Thanks for providing any insight.
> >Scott.
> >
> >
> The odds are that the remote table is being read via a full table scan
 within
> a nested loop. You can see this by running an explain plan on the SQL,
 which
> should give you a pretty good idea what Oracle is doing and you can see
 the
> SQL passed to the remote system in the plan_table.other column.

>

> Where you normally rewrite SQL into a join to tune it, when dealing with a
> distributed query you often have to convert the join into a sub-query to
 get
> it to run well. In your case since you have a driving index, I think you
> probably should try to perform a coordinated subquery against the remote
> table for each row returned by the driving query. The join columns on the
> remote table need to be indexed. This will allow an indexed look-up for
 each
> row returned in the driver and if the remote table is of any size will
 prove
> superior to a full table scan.
>

> -- Mark D. Powell --
>
>

> ----- Posted via NewsOne.Net: Free (anonymous) Usenet News via the
 eb -----
> http://newsone.net/ -- Free reading and anonymous posting to 60,000+
 groups
> NewsOne.Net prohibits users from posting spam. If this or other posts
> made through NewsOne.Net violate posting guidelines, email
abuse_at_newsone.net Received on Wed Apr 25 2001 - 08:06:33 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US