Hello Igor, On Sun, Oct 24, 2010 at 02:22:02PM -0700, Igor Babaev wrote:
At file:///home/igor/maria/maria-5.3-mwl128-bug664508/
------------------------------------------------------------ revno: 2833 revision-id: igor@askmonty.org-20101024212201-t8iius4jikcvm3zb parent: igor@askmonty.org-20101022223047-phunrh5g3xzrx2d9 committer: Igor Babaev <igor@askmonty.org> branch nick: maria-5.3-mwl128-bug664508 timestamp: Sun 2010-10-24 14:22:01 -0700 message: Fixed LP bug #664508. When join buffers are employed no index scan for the first table with grouping columns can be used. ... === modified file 'sql/sql_select.cc' --- a/sql/sql_select.cc 2010-10-18 20:56:48 +0000 +++ b/sql/sql_select.cc 2010-10-24 21:22:01 +0000 @@ -7980,8 +7980,11 @@ JOIN_TAB *tab=join->join_tab+i; if (tab->use_join_cache) { - JOIN_TAB *sort_by_tab= join->get_sort_by_join_tab(); - if (sort_by_tab && !join->need_tmp) + JOIN_TAB *sort_by_tab= join->group && join->simple_group && + join->group_list ? + join->join_tab+join->const_tables : + join->get_sort_by_join_tab(); + if (sort_by_tab) { join->need_tmp= 1; join->simple_order= join->simple_group= 0;
Here sort_by_tab is assigned inside the " for (i=join->const_tables ; ..." loop. I think the code will look much more cleaner if it was calculated before the loop (and actually we don't need to loop at all if sort_by_tab==NULL).
_______________________________________________ commits mailing list commits@mariadb.org https://lists.askmonty.org/cgi-bin/mailman/listinfo/commits
-- BR Sergey -- Sergey Petrunia, Software Developer Monty Program AB, http://askmonty.org Blog: http://s.petrunia.net/blog