← Back to team overview

maria-developers team mailing list archive

FirstMatch strategy and interleaving



I was looking through subquery code and found the following issue 
with FirstMatch strategy:

Our original intent with FirstMatch strategy was to support join orders where 
sj-inner tables are interleaved with outer tables that are not correlated
with the subquery. FirstMatch spec is here, 
http://forge.mysql.com/worklog/task.php?id=3750, the question of interleaving
is covered in section 2.2.

[I assumed] I have coded this for non-buffered join execution, both optimizer
and executioner support. The first problem I saw was that it didn't seem to
be possible to come up with dataset/query that would cause the join optimizer
to pick such join order. I don't know whether this is because the cost formulas
make the choice impossible or I'm just not finding the right examples. Either
way, mysql-test-run suite has no coverage for FirstMatch+interleaving.

Now, when I look at the source code and/or force the choice of FirstMatch+
interleaving join order by changing costs from gdb, I find out that:

- setup_semijoin_dups_elimination() has a bug that will make the query produce
  incorrect result

- Join bufferring now supports FirstMatch with multiple inner tables but
  doesn't support FirstMatch+interleaving.

Since I'm not comfortable with making fixes for something that I can't have
testcases for, I'm considering disabling FirstMatch+interleaving. We can get
back to it when we have a better understanding of what goes on in the cost

Any objections?

Sergey Petrunia, Software Developer
Monty Program AB, http://askmonty.org
Blog: http://s.petrunia.net/blog

Follow ups