14 Replies Latest reply on Nov 4, 2016 3:20 PM by shawkins

    performance issue when joining a materialized view to a table

    mtawk

      I'm using Teiid 8.11.3 with oracle translator


      When executing the following query through teiid:

      select "StreamCardsf8GL"."StreamCards_DateTime" as "StreamCardsf8GL_StreamCards_1",AVG(1.0 * "StreamCardsf8GL"."StreamCards_Amount") as "StreamCardsf8GL_StreamCards_2","TagValue"."TextValue" as "TagValue_TextValue1","StreamCardsf8GL"."StreamCards_DateTime1" as "StreamCardsf8GL_StreamCards_21" from "BaegyBusinessModel"."StreamCardsf8GL" "StreamCardsf8GL" LEFT JOIN "BaegyBusinessModel"."CEGlobalView" "CEGlobalView" ON "StreamCardsf8GL"."StreamCards_Customer_Custome" = "CEGlobalView"."Customer_CustomerID" LEFT JOIN "impdbModel_jI"."IMPUSER"."CustomerTag" "CustomerTag" ON "CEGlobalView"."Customer_CustomerID" = "CustomerTag"."Customer_CustomerID" LEFT JOIN "impdbModel_jI"."IMPUSER"."TagValue" "TagValue" ON "CustomerTag"."TagValue_TagValueID" = "TagValue"."TagValueID" where ( ( ("TagValue"."TextValue" IN ('cluster_4') ) ) AND ( ("StreamCardsf8GL"."StreamCards_DateTime" IS NOT null ) ) AND ( ("TagValue"."TextValue" IS NOT null ) ) ) group by "StreamCardsf8GL"."StreamCards_DateTime","TagValue"."TextValue","StreamCardsf8GL"."StreamCards_DateTime1" order by "StreamCardsf8GL"."StreamCards_DateTime1" ASC,"StreamCardsf8GL"."StreamCards_DateTime" ASC,"TagValue"."TextValue" DESC

       

      3 jdbc queries executed by teiid and the last one is taking too much time (joining a materialized view to a table):

      1. SELECT g_0."Customer_CustomerID" AS c_0 FROM "IMPUSER"."CustomerTag" g_0, "IMPUSER"."TagValue" g_1 WHERE g_0."TagValue_TagValueID" = g_1."TagValueID" AND g_1."TextValue" = 'cluster_4' ORDER BY c_0
      2. SELECT g_0."Customer_CustomerID" AS c_0, g_1."TextValue" AS c_1 FROM "IMPUSER"."CustomerTag" g_0, "IMPUSER"."TagValue" g_1 WHERE g_0."TagValue_TagValueID" = g_1."TagValueID" AND g_1."TextValue" = 'cluster_4' AND g_1."TextValue" IS NOT NULL ORDER BY c_0
      3. SELECT g_1."Customer_CustomerID", g_0."StreamCards_DateTime11", g_0."StreamCards_DateTime1", SUM((1.0 * g_0."StreamCards_Amount")), COUNT((1.0 * g_0."StreamCards_Amount"))

      FROM "IMPUSER"."StreamCardsf8GL" g_0

      LEFT OUTER JOIN "IMPUSER"."CEGlobalView" g_1 ON g_0."StreamCards_Customer_Custome" = g_1."Customer_CustomerID"

      WHERE g_0."StreamCards_DateTime11" IS NOT NULL AND (g_1."Customer_CustomerID" IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?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?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) OR g_1."Customer_CustomerID" IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)) GROUP BY g_1."Customer_CustomerID", g_0."StreamCards_DateTime11", g_0."StreamCards_DateTime1"

        • 1. Re: performance issue when joining a materialized view to a table
          shawkins

          > joining a materialized view to a table

           

          You mean to an external materialization?

           

          How many rows are in CEGlobalView?  It seems likely that a dependent join is desirable here.  Is there an index on Customer_CustomerID?

          • 2. Re: performance issue when joining a materialized view to a table
            mtawk

            yes external materialization.

             

            I guess it contains around 60000 rows,

             

            i reduced in the query sql text added in the initial message, it contained much more values

             

            actually i cannot access the db to know if the field has an index. I will tell you tomorrow


            Does the index affect the way the jdbc query is written?

            • 3. Re: performance issue when joining a materialized view to a table
              shawkins

              > Does the index affect the way the jdbc query is written?

               

              Not necessarily.  If the table is significantly larger than the other side of the join, we'll use the equi-join values from the other side as a filter to limit how many rows are read - otherwise we'll have to pull in all the rows.  So it's more of an expectation that there will typically be an index on the join column and that the resulting filtered query will have better performance than reading all of the rows. 

               

              You can also try to disabling bind parameters for the oracle translator - with [TEIID-3530] dependent join enhancements - JBoss Issue Tracker later versions of Teiid disable the use of bind values for dependent joins with oracle as that seems to cause issues.

              • 4. Re: performance issue when joining a materialized view to a table
                mtawk

                In Teiid 9, binding is disabled, but still the execution is taking too much time, even though the concerned column is well indexed.

                 

                is there a way to enable/disable equi-join for not to pull in all the rows, since in my case there are 3 million records and the execution is taking too much time.

                 

                I have the materialized view and the joined table on the same schema in my oracle server, is it possible to send from teiid one jdbc query since the view and the table shares the same oracle connection? because executing the initial query on oracle via jdbc took less then one second.

                • 5. Re: performance issue when joining a materialized view to a table
                  mtawk

                  Also i noticed that the query is repeated multiple times with each time containing a criteria over approximately 50000 values

                  • 6. Re: performance issue when joining a materialized view to a table
                    shawkins

                    > is there a way to enable/disable equi-join for not to pull in all the rows, since in my case there are 3 million records and the execution is taking too much time.

                     

                    So to confirm what you are seeing here is a join between a 60000 row materialized view and a ~3-6 million row table.  Teiid is choosing to do a dependent join, which will issue queries of approximately 50000 values and 10000 values against the larger table.  That should result in significantly less than 3 million records being pulled into Teiid.  Or are you saying that the dependent join is in the other direction, such that the larger table is being used to query the smaller?  It may also be good to post the query plan as well.

                     

                    > I have the materialized view and the joined table on the same schema in my oracle server, is it possible to send from teiid one jdbc query since the view and the table shares the same oracle connection? because executing the initial query on oracle via jdbc took less then one second.

                     

                    If two models/schemas use the same translator and JNDI connection, we will automatically assume that source queries can be combined yes.

                    • 7. Re: performance issue when joining a materialized view to a table
                      mtawk

                      I confirm that the model/schema are the same, and they are not combined. and the execution of the combined query is much faster.

                       

                      You find attached a similar case query with the plan and jdbc queries executed by teiid.

                      • 8. Re: performance issue when joining a materialized view to a table
                        shawkins

                        > I confirm that the model/schema are the same, and they are not combined. and the execution of the combined query is much faster.

                         

                        I don't think we have a common understanding here yet.  I'm saying that if you have two teiid models that point to the same translaor/jndi name, then they will be treated as equivalent for pushdown purposes.

                         

                        In the attached plan you have 3 source queries against two models porcl1dbdataositModel_tq and porcl1dbdataositModel_eA.  Are you saying that porcl1dbdataositModel_eA and porcl1dbdataositModel_tq represent the same source, or are you saying that you expect the two queries against porcl1dbdataositModel_tq to be combined?

                         

                        And is still using Teiid 8.11.3?

                        • 9. Re: performance issue when joining a materialized view to a table
                          mtawk

                           

                          I'm using teiid 9.0.0

                          porcl1dbdataositModel_eA and porcl1dbdataositModel_tq represent the same source.

                          You can see in the executed JDBC queries that they are using the same oracle schema.

                          The main issue in here is a performance issue, the repeated query with criteria over 50000 values is taking too much time on Oracle, even if the field is indexed.

                          I have seen in many other cases when joining materialized views with tables from different models but with same sources, teiid is running the jdbc query combined.

                          I don't know why in this case, it is executing 3 jdbc queries causing a big performance issue.

                          Is there a way to force a combined query in such a case?

                          • 10. Re: performance issue when joining a materialized view to a table
                            shawkins

                            > You can see in the executed JDBC queries that they are using the same oracle schema.

                             

                            What matters is how they are configured in the vdb.xml.  Are they using the same translator/jndi?

                            • 11. Re: performance issue when joining a materialized view to a table
                              mtawk

                              I'm using teiid embedded, how can I check if they have the same translator/jndi?

                              • 12. Re: performance issue when joining a materialized view to a table
                                shawkins

                                If you are using the api, then it's based upon the call to addSourceMapping.  The translator and connJndi name need to be the same for both Models.

                                • 13. Re: performance issue when joining a materialized view to a table
                                  mtawk

                                  in my case one of the models is of type virtual (where the materialized views are deployed),

                                  In this case the translator and jndi are not set into the virtual model.

                                  Each externally materialized views is related to a certain model.

                                  if the comparison is done between the externally materialized view model and the table model, translator and jndi are the same for both.

                                  • 14. Re: performance issue when joining a materialized view to a table
                                    shawkins

                                    Yes, the comparison will be done on where ever the materialization targets are at.