4 Replies Latest reply on May 13, 2015 1:40 PM by shawkins

    Multiple access patterns

    markaddleman

      I have a table whose clients must supply one of two columns or both in a query.  I have created three access patterns for the three possibilities: column a or column b or columns a & b. The performance of the data source depends on which columns are pushed down.  Is there a way to hint the planner that certain access patterns have precedence over others?

        • 1. Re: Multiple access patterns
          shawkins

          No, currently the logic just checks that any one of the access patterns is satisfied.  Do you have a dependent join scenario?

          • 2. Re: Multiple access patterns
            markaddleman

            > Do you have a dependent join scenario?


            Yes.


            From a brief spelunking through the code, it appears that the relevant logic is in RulePlanJoins.  I think that if we can maintain the ordered list of access patterns, I can influence the planner's decision by creating the metadata in my preferred order.  Does that seem right to you?

            • 3. Re: Multiple access patterns
              markaddleman

              There is a sort in org.teiid.query.optimizer.relational.rules.RulePlaceAccess.addAccessPatternsProperty(PlanNode, QueryMetadataInterface) that appears to be the culprit here.  Is that sort necessary?  Can I change the sorting logic in AccessPattern.compareTo?

              • 4. Re: Multiple access patterns
                shawkins

                > Is that sort necessary?  Can I change the sorting logic in AccessPattern.compareTo?

                 

                No I don't think that the sort is necessary any more.

                 

                However I'm not sure if that will help out.  The join logic should just be forming the dependent join based upon all of the equi-join predicates.  The only time we consider less is when there is a key relationship.