List:Internals« Previous MessageNext Message »
From:Mark Callaghan Date:July 18 2007 3:12am
Subject:How can I disable equality propagation in MySQL 5.0
View as plain text  
MySQL 5.0 added equality propagation to the optimizer. This has made
some of my queries much slower, both the cost of optimization and the
resulting plans. The problem occurs for queries with large inlists.
For example:

select * from t1, t2 where t1.a = t2.a and t1.a in (<large_in_list>)
and t2.b between Const1 and Const2

In this query, the optimizer appears to be adding: t2.a in
(<large_in_list>) and this is done despite the size of the inlist.
Many of my queries have thousands of values in these inlists. I know
that predicates are being added because handler::records_in_range is
called on t2 by check_quick_keys() once for each value in the inlist.

I want to disable equality propagation for large inlists, but I have
yet to figure out how to do this. I have disabled it for tables for
which there is a FORCE INDEX hint (done by adding code to
check_simple_equality), but it is too much work to add hints to all
queries with large inlists. I have added code to
build_equal_items_for_cond() to disable calls to check_equality() for
items that are large inlists, but that does not work. I need to either
prevent propagation somewhere else in the code or do something in
build_equal_items_for_cond() when the join condition is processed.

Can someone point me to the right place in the code?

I have a support ticket open for this, but that has yet to resolve my problem.

-- 
Mark Callaghan
mcallaghan@stripped
Thread
How can I disable equality propagation in MySQL 5.0Mark Callaghan18 Jul
Re: How can I disable equality propagation in MySQL 5.0Sergey Petrunia19 Jul
  • Re: How can I disable equality propagation in MySQL 5.0Mark Callaghan19 Jul
    • Re: How can I disable equality propagation in MySQL 5.0Jay Pipes20 Jul
      • Re: How can I disable equality propagation in MySQL 5.0Sergey Petrunia20 Jul
        • the IN list optimizer speed [Re: How can I disable equality propagationin MySQL 5.0]Martin Friebe20 Jul
          • Re: the IN list optimizer speed [Re: How can I disable equalitypropagation in MySQL 5.0]Lenz Grimmer24 Jul
            • Re: the IN list optimizer speed [Re: How can I disable equality propagation in MySQL 5.0]Sergey Petrunia31 Jul
          • Re: the IN list optimizer speed [Re: How can I disable equality propagation in MySQL 5.0]Sergey Petrunia31 Jul
        • Re: How can I disable equality propagation in MySQL 5.0Jay Pipes20 Jul