[Maria-developers] Rev 2745: Merge in file:///home/psergey/dev/maria-5.3-subqueries-r2/
At file:///home/psergey/dev/maria-5.3-subqueries-r2/ ------------------------------------------------------------ revno: 2745 revision-id: psergey@askmonty.org-20100117145508-8xclgicfyqr82i78 parent: psergey@askmonty.org-20100117145110-s4afy4wi9qoo2tuz parent: psergey@askmonty.org-20100101083655-abhuypjpebzvk33p committer: Sergey Petrunya <psergey@askmonty.org> branch nick: maria-5.3-subqueries-r2 timestamp: Sun 2010-01-17 17:55:08 +0300 message: Merge modified: sql/sql_select.cc sp1f-sql_select.cc-19700101030959-egb7whpkh76zzvikycs5nsnuviu4fdlb ------------------------------------------------------------ revno: 2743.1.1 revision-id: psergey@askmonty.org-20100101083655-abhuypjpebzvk33p parent: psergey@askmonty.org-20091227202422-fs9fgo8x2wk9ry15 committer: Sergey Petrunya <psergey@askmonty.org> branch nick: maria-5.3-subqueries-r2-commit timestamp: Fri 2010-01-01 10:36:55 +0200 message: Backport of subquery optimizations to 5.3 modified: sql/handler.h sp1f-handler.h-19700101030959-mumq2hpilkpgxuf22ftyv5kbilysnzvn sql/item.cc sp1f-item.cc-19700101030959-u7hxqopwpfly4kf5ctlyk2dvrq4l3dhn sql/item.h sp1f-item.h-19700101030959-rrkb43htudd62batmoteashkebcwykpa sql/item_cmpfunc.cc sp1f-item_cmpfunc.cc-19700101030959-hrk7pi2n6qpwxauufnkizirsoucdcx2e sql/item_cmpfunc.h sp1f-item_cmpfunc.h-19700101030959-pcvbjplo4e4ng7ibynfhcd6pjyem57gr sql/item_func.cc sp1f-item_func.cc-19700101030959-3wmsx76yvc25sroqpfrx2n77kqdxxn3y sql/item_func.h sp1f-item_func.h-19700101030959-fbjcbwkg66qubbzptqwh5w5evhnpukze sql/item_row.cc sp1f-item_row.cc-20021115183204-24uyecwm52gv5pn6jtszpqpfufhwmisq sql/item_row.h sp1f-item_row.h-20021115183204-x25ouues4bddw4mt6qqjchrgmtmn4kit sql/item_subselect.cc sp1f-item_subselect.cc-20020512204640-qep43aqhsfrwkqmrobni6czc3fqj36oo sql/item_subselect.h sp1f-item_subselect.h-20020512204640-qdg77wil56cxyhtc2bjjdrppxq3wqgh3 sql/mysql_priv.h sp1f-mysql_priv.h-19700101030959-4fl65tqpop5zfgxaxkqotu2fa2ree5ci sql/mysqld.cc sp1f-mysqld.cc-19700101030959-zpswdvekpvixxzxf7gdtofzel7nywtfj sql/sql_array.h sp1f-sql_array.h-20050825133416-2x4rfme6g6pqpipb27khpj6oifhxvqhw sql/sql_base.cc sp1f-sql_base.cc-19700101030959-w7tul2gb2n4jzayjwlslj3ybmf3uhk6a sql/sql_class.h sp1f-sql_class.h-19700101030959-jnqnbrjyqsvgncsibnumsmg3lyi7pa5s sql/sql_lex.cc sp1f-sql_lex.cc-19700101030959-4pizwlu5rqkti27gcwsvxkawq6bc2kph sql/sql_lex.h sp1f-sql_lex.h-19700101030959-sgldb2sooc7twtw5q7pgjx7qzqiaa3sn sql/sql_parse.cc sp1f-sql_parse.cc-19700101030959-ehcre3rwhv5l3mlxqhaxg36ujenxnrcd sql/sql_prepare.cc sp1f-sql_prepare.cc-20020612210720-gtqjjiu7vpmfxb5xct2qke7urmqcabli sql/sql_select.cc sp1f-sql_select.cc-19700101030959-egb7whpkh76zzvikycs5nsnuviu4fdlb sql/sql_select.h sp1f-sql_select.h-19700101030959-oqegfxr76xlgmrzd6qlevonoibfnwzoz sql/sql_show.cc sp1f-sql_show.cc-19700101030959-umlljfnpplg452h7reeyqr4xnbmlkvfj sql/sql_test.cc sp1f-sql_test.cc-19700101030959-7fpt436b3qzk75qpy7rqpho7nkesvwuz sql/sql_union.cc sp1f-sql_unions.cc-20010613103653-ljpdcuczpligpiljxsifua5riwhxyomz sql/sql_update.cc sp1f-sql_update.cc-19700101030959-edlgskfuer2ylczbw2znrr5gzfefiyw7 sql/structs.h sp1f-structs.h-19700101030959-dqulhwijezc2pwv2x4g32qdggnybj2nc sql/table.h sp1f-table.h-19700101030959-dv72bajftxj5fbdjuajquappanuv2ija === modified file 'sql/sql_select.cc' --- a/sql/sql_select.cc 2010-01-17 14:51:10 +0000 +++ b/sql/sql_select.cc 2010-01-17 14:55:08 +0000 @@ -14587,7 +14587,6 @@ &tmpname, (uint) strlen(path)+1, &group_buff, (!using_unique_constraint ? uniq_tuple_length_arg : 0), - &bitmaps, bitmap_buffer_size(1)*3, NullS)) { if (temp_pool_slot != MY_BIT_NONE) @@ -16127,6 +16126,45 @@ } } + +/* + SemiJoinDuplicateElimination: Weed out duplicate row combinations + + SYNPOSIS + do_sj_dups_weedout() + thd Thread handle + sjtbl Duplicate weedout table + + DESCRIPTION + Try storing current record combination of outer tables (i.e. their + rowids) in the temporary table. This records the fact that we've seen + this record combination and also tells us if we've seen it before. + + RETURN + -1 Error + 1 The row combination is a duplicate (discard it) + 0 The row combination is not a duplicate (continue) +*/ + +int do_sj_dups_weedout(THD *thd, SJ_TMP_TABLE *sjtbl) +{ + int error; + SJ_TMP_TABLE::TAB *tab= sjtbl->tabs; + SJ_TMP_TABLE::TAB *tab_end= sjtbl->tabs_end; + + DBUG_ENTER("do_sj_dups_weedout"); + + if (sjtbl->is_confluent) + { + if (sjtbl->have_confluent_row) + DBUG_RETURN(1); + else + { + sjtbl->have_confluent_row= TRUE; + DBUG_RETURN(0); + } + } + uchar *ptr= sjtbl->tmp_table->record[0] + 1; uchar *nulls_ptr= ptr;
participants (1)
-
Sergey Petrunya