Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

What hints do I need for OR expansion here?

Scott SwankAug 14 2020 — edited Aug 19 2020

I'm running into some trouble getting a decent plan for a pretty simple query.

Here's the background:

1. cat_contact is the parent table. It has 3.6M rows. I want these 3100 rows from it, which I can get via an indexed read.

SELECT *

FROM cat_contact

WHERE contact_method_id IN ('A', 'B', 'C');

2. cat_item is the child table and has 3.7M rows. I also want these 7600 rows from cat_contact, which again I can get pretty efficiently via the expected nested loop semi-join.

SELECT *

FROM cat_contact c

WHERE EXISTS (

   SELECT *

   FROM cat_item i

   WHERE i.contact_id = c.contact_id

   AND i.item_category in ('X', 'Y')

);

I combine them in the obvious way, and things go sideways.

SELECT /*+ gather_plan_statistics */ *

FROM cat_contact. c

WHERE contact_method_id IN ('A', 'B', 'C')

OR (

   SELECT *

   FROM cat_item i

   WHERE i.contact_id = c.contact_id

   AND i.item_category in ('X', 'Y')

);

With the following plan and resulting performance (12,891,692 gets).

------------------------------------------------------------------------------------------------------------------------------------------------------------------

| Id  | Operation                            | Name                   | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time   | A-Rows |   A-Time   | Buffers | Reads  |

------------------------------------------------------------------------------------------------------------------------------------------------------------------

|   0 | SELECT STATEMENT                     |                        |      1 |        |       | 10185 (100)|          |   7745 |00:01:39.48 |      12M|    138K|

|*  1 |  FILTER                              |                        |      1 |        |       |            |          |   7745 |00:01:39.48 |      12M|    138K|

|   2 |   TABLE ACCESS FULL                  | CAT_CONTACT            |      1 |   1208K|    24M| 10185   (2)| 00:00:04 |      3M|00:00:12.64 |     111K|    111K|

|*  3 |   TABLE ACCESS BY INDEX ROWID BATCHED| CAT_ITEM               |      3M|      1 |    11 |     2   (0)| 00:00:01 |   4611 |00:02:20.77 |      12M|  26803 |

|*  4 |    INDEX RANGE SCAN                  | CAT_ITEM_CONTACT_ID_IX |      3M|      1 |       |     1   (0)| 00:00:01 |      3M|00:00:46.00 |       9M|   3903 |

------------------------------------------------------------------------------------------------------------------------------------------------------------------

I can get completely acceptable performance if I use query factoring instead, 29,731 consistent gets. But my effort at hinting my way to an equivalent plan for the simpler query (use_concat, nl_sj, etc) have failed thus far.

WITH

    cat_contact1 AS

        (SELECT *

           FROM cat_contact cc

          WHERE cc.contact_method_id IN ('A', 'B', 'C')),

    cat_contact2 AS

        (SELECT *

           FROM cat_contact cc

          WHERE EXISTS

                    (SELECT *

                       FROM cat_item ci

                      WHERE ci.contact_id = cc.contact_id

                        AND ci.item_category IN ('X', 'Y')))

SELECT * FROM cat_contact1

UNION

SELECT * FROM cat_contact2;

Any suggestions?

Comments

Wayne Seltzer-Oracle

Hi,

Sorry you're having the heartbeat failure problem.

Does "asr test_connection" work correctly?

You can review the log files in /var/opt/SUNWsasm/logs.

If you need assistance resolving the problem, you can open a service request for the ASR Support Team via My Oracle Support [http://support.oracle.com].

Best Regards,

Wayne Seltzer

ASR Product Manager

Oracle Services

user523412

Hi Wayne,

Thanks for the reply.

the machine doesn't install with asr tools, asr_connection doesn't work here

From the sw-asr.log it show there is connection to transport oracle. I had check on the network but all is fine

Can you tell what the problem means here

Jun 24, 2013 5:50:39 AM com.sun.svc.common.TransportService sendHeartbeatMessage

WARNING: DTS warning :Connection to https://transport.oracle.com refused Retrying..

Jun 24, 2013 5:50:39 AM com.sun.svc.common.TransportService sendHeartbeatMessage

WARNING: DTS warning :Connection to https://transport.oracle.com refused Retrying..

Jun 24, 2013 5:50:39 AM com.sun.svc.common.TransportService sendHeartbeatMessage

WARNING: DTS warning :Connection to https://transport.oracle.com refused Retrying..

Jun 24, 2013 5:50:39 AM com.sun.svc.common.TransportService sendHeartbeatMessage

SEVERE: Failed to send message to transport queue

Jun 24, 2013 5:50:39 AM com.sun.svc.activation.impl.ManageAssetService generateHeartbeat

WARNING: Failed to generate heartbeat for OASM ASR Plugin due to transport problem.

Aside for 2nd ques, I had no idea how to escalated SR to support.oracle.com, do you have the template to create the SR?

Thanks,

Looking forward your reply.

Jack

user523412

hi anyone know the answer?

i try to ping to https://transport.oracle.com/v1/queue/asr-heartbeat from the server but it's fails.

If this is the reason the ASR Man can't talk to Oracle Transport How do I know whether the problem came from internal network or the ASR Man doesn't work normally.

Can someone share the expertise here?

Thanks,

Jack

Jack,

The ASR Manager installation and operations guide  (on http://oracle.com/asr ... Documentation ... )

includes troubleshooting instructions:

4.12.5 Test Connectivity from the ASR Manager to Oracle

The following procedure can be used to confirm proper communication between the ASR Manager and Oracle's ASR backend systems. 

    1. Complete one of the following steps from the ASR Manager to verify connectivity to Oracle's ASR backend systems:
    2. Determine if your network's DNS configuration is able to resolve transport.oracle.com. You may need to configure your firewall to enable outbound Internet access to transport.oracle.com.

      If DNS is not available on the ASR Manager host, you may need to manually add an entry for transport.oracle.com and its IP address to the /etc/hosts file. Use any DNS lookup service on the Internet to determine the IP address for transport.oracle.com.

    3. You may need to contact your network administrator for assistance. Refer to "Network Connection Requirements" for the specific ASR network requirements.
  1. If the results of the above commands do not indicate the Data Transport Service is operating, you must resolve your network connection issue. Listed below are possible resolutions:
    • If you use a proxy server, the issue could be that the proxy information has not yet been configured to ASR and OASM. This is done by registering ASR, as discussed in the following procedure.

Best Regards,

Wayne

1 - 4

Post Details

Added on Aug 14 2020
11 comments
1,141 views