4 Replies Latest reply on Feb 20, 2013 11:46 AM by shawkins

    Join of reusable and non reusable executions

    rakeshsagar

      Hi all,

       

      I am facing a problem with a join in Reusable and Non-Reusable executions when one of the non-reusable datasource has data and the other doesn't have the data.

       

      The problem I am facing is that the Non-Reusable executions are being repeated continuously and the Reusable execution is not getting executed at all.

       

      The following is the SQL and please find the attached query plan and test case to reproduce this problem.

       

      SELECT LATEST_HEALTH_STATE.*

      FROM

        (SELECT LATEST_HEALTH_STATE.*

         FROM

           (SELECT 'healthstatestream.LATEST_HEALTH_STATES' AS "__objecttype__",

                   name,

                   rgb,

                   severity,

                   objecttype,

                   worst_severity_by_policy.title

            FROM healthstatestream.health_states

            INNER JOIN

              (SELECT MIN(healthstatefkey) AS worst_health_state,

                      Object_type(objfkeyxml) AS objectType,

                      metadata.propertyvalue AS title

               FROM (healthstatestream.latest_health_states

                     INNER JOIN

                       (SELECT '<demo_policy_metadata.op_demo_policy_type_1 policyid=''policy name 1'' policyname=''policy 1001'' systemid=''sysid 1''></demo_policy_metadata.op_demo_policy_type_1>' AS POLICYFKEYXML) AS policies_configured_in_traffic_light ON latest_health_states.policyfkeyxml = policies_configured_in_traffic_light.policyfkeyxml)

               INNER JOIN chorus_metadata.property AS metadata ON Object_type(objfkeyxml) = metadata.objectname

               AND metadata.propertyname = 'VisibleName'

               AND metadata.subtype = 'Object'

               GROUP BY Object_type(objfkeyxml),

                        metadata.propertyvalue) AS worst_severity_by_policy ON worst_severity_by_policy.worst_health_state = health_states.severity) AS LATEST_HEALTH_STATE,

              (EXEC chorus_time.timetable(30000)) AS chorus_refresh_expression) AS LATEST_HEALTH_STATE

       

      Note: We tested using teiid 8.3.0.Beta2.

       

      Please suggest.

       

      Thanks,

      Rakesh.

        • 1. Re: Join of reusable and non reusable executions
          markaddleman

          It appears that Teiid is functioning correctly in this case.  The left side of the join has no data, so Teiid does not try to execute against the right side of the join.  Since the right side of the join is the timing mechanism for the continuous query and it is never executed, the query loops repeatedly with no delay between executions.  I believe the solution is to reorder the query or perform an outter join instead.

          • 2. Re: Join of reusable and non reusable executions
            shawkins

            Have you considered using a source hint / delegation to specify the time interval?  This would save you simple cross joins.

             

            In 8.3 there is also the PRESERVE join hint: https://issues.jboss.org/browse/TEIID-2341 if you want to force the join order.

             

            Steve

            1 of 1 people found this helpful
            • 3. Re: Join of reusable and non reusable executions
              markaddleman

              I don't think hints will work for us.  In general, we can have multiple data sources involved in a query, each one can 'refresh' at a different rate or, in fact, based on non-timebased event query. 

               

              The PRESERVE hint looks promising but I'm not sure I understand how this is different from the MAKEDEP clause. To be honest, I'm not sure I completely understand how MAKEDEP affects query processing.

              • 4. Re: Join of reusable and non reusable executions
                shawkins

                MAKEDEP isn't applicable for cross joins.  For inner sides of a join with equi-join criteria the MAKEDEP hint will force the other side of the join to be processed first - and the set of join values is then used to restrict what is fetched from the other side of the join.  The makedep hint is only needed when the optimizer doesn't choose a dependent join in the first place.