MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Jørgen Løland Date:June 23 2010 11:14am
Subject:Re: bzr commit into mysql-next-mr-bugfixing branch (olav:3188)
Bug#52605
View as plain text  
Olav,

The code changes look good and the explanation is excellent, but I have a 
question about the test results. See comment inline.

Olav Sandstaa wrote:
> === modified file 'mysql-test/r/order_by.result'
> --- a/mysql-test/r/order_by.result	2010-05-12 16:03:52 +0000
> +++ b/mysql-test/r/order_by.result	2010-06-08 10:37:56 +0000
> @@ -617,7 +617,7 @@
>  3	3	3
>  EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal;
>  id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
> -1	SIMPLE	t1	range	FieldKey,LongField,StringField	LongField	38	NULL	4	Using where
> +1	SIMPLE	t1	range	FieldKey,LongField,StringField	LongField	38	NULL	4	

If I understand this correctly, "using where" should not be printed here because 
the condition has been pushed to the engine. Thus, it would be more correct to 
print "Using index condition" in the extra column.

In the test case above the condition is pushed to the FieldKey index

--- From trace ---
WHERE:(icp cond) 0x9e7db98 (`test`.`t1`.`FieldKey` > '2')
WHERE:(remainder cond) (nil)
------------------

...but the index to use is later changed to LongField. Still, the condition is 
pushed and will be evaluated by the engine. It seems to me that this 
modification will print more correct Extra columns:

=== modified file 'sql/sql_select.cc'
--- sql/sql_select.cc	2010-06-17 09:31:07 +0000
+++ sql/sql_select.cc	2010-06-23 11:00:52 +0000
@@ -22318,7 +22324,7 @@ void select_describe(JOIN *join, bool ne
          else if (tab->select && tab->select->quick)
            keyno = tab->select->quick->index;

-        if ((keyno != MAX_KEY && keyno ==
table->file->pushed_idx_cond_keyno &&
+        if ((keyno != MAX_KEY &&
               table->file->pushed_idx_cond) || tab->cache_idx_cond)
            extra.append(STRING_WITH_LEN("; Using index condition"));

What do you think? I can agree to your point that this may be an unrelated bug, 
but in that case we might want to create a bug for it.

-- 
Jørgen Løland
Thread
bzr commit into mysql-next-mr-bugfixing branch (olav:3188) Bug#52605Olav Sandstaa8 Jun
  • Re: bzr commit into mysql-next-mr-bugfixing branch (olav:3188)Bug#52605Jørgen Løland23 Jun
    • Re: bzr commit into mysql-next-mr-bugfixing branch (olav:3188)Bug#52605Olav Sandstaa30 Jun