Skip to content

Instantly share code, notes, and snippets.

View fix-ratio.diff
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index 91b7121bd8d..0b76a5bef46 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -3458,9 +3458,11 @@ bool Firstmatch_picker::check_qep(JOIN *join,
@@optimizer_switch allows join buffering.
- read_time is the same (i.e. FirstMatch doesn't add any cost
- remove fanout added by the last table
+ (if it is more than 1)
*/
View 1.diff
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index f121a592d5b..ac447286a56 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -3635,12 +3636,12 @@ bool Duplicate_weedout_picker::check_qep(JOIN *join,
if (p->table->emb_sj_nest)
{
- sj_inner_fanout= COST_MULT(sj_inner_fanout, p->records_read);
+ sj_inner_fanout= COST_MULT(sj_inner_fanout, p->records_out);
View 1.diff
git diff ../client/mysqltest.cc
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index c462e9ee662..1a2928d2fe8 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -8582,6 +8582,7 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
var_set_errno(mysql_stmt_errno(stmt));
+ display_optimizer_trace(cn, ds);
View psergey-mdev25080-cleanups-sept8.diff
diff --git a/sql/select_handler.cc b/sql/select_handler.cc
index 99bd2c0cf7f..08d08d12423 100644
--- a/sql/select_handler.cc
+++ b/sql/select_handler.cc
@@ -64,10 +64,9 @@ TABLE *select_handler::create_tmp_table(THD *thd)
List<Item> types;
TMP_TABLE_PARAM tmp_table_param;
- if (select_lex &&
- select_lex->master_unit()->join_union_item_types(thd, types, 1))
View gist:6862c9ffc5609bc2f8d4b7a5794b90ee
analyze format=json select count(t2.b) from t1, t2 where t2.a=t1.a;
| {
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": 579.7733801,
"nested_loop": [
{
"table": {
View psergey-fix-sjm1.diff
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 830a84cc037..0e5630d2cf2 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -10238,8 +10238,8 @@ best_extension_by_limited_search(JOIN *join,
If we are searching for the execution plan of a materialized semi-join nest
then allowed_tables contains bits only for the tables from this nest.
*/
- allowed_current_tables= allowed_tables=
- (join->emb_sjm_nest->sj_inner_tables & remaining_tables);
View get_allowed_nj_tables.diff
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 5f4881b2f54..31badd10746 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -117,6 +117,7 @@ enum enum_best_search {
SEARCH_OK= 0,
SEARCH_FOUND_EDGE=1
};
+static table_map get_allowed_nj_tables(JOIN *join, uint idx);
static enum_best_search
View 1.diff
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 21e12ffae34..47e74291bf4 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -5399,6 +5399,17 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
}
}
+ {
+ for (JOIN_TAB *s= stat ; s < stat_end ; s++)
View gist:40ee04e2663ca530b943decd8b7efc12
mariadbd: /home/psergey/dev-git2/10.6/storage/maria/ma_loghandler.c:8008: translog_flush_buffers: Assertion `log_descriptor.bc.buffer->prev_last_lsn == ((LSN)0)' failed.
220525 18:39:30 [ERROR] mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
To report this bug, see https://mariadb.com/kb/en/reporting-bugs
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
View mdev-26247-basic-tablesample.sql
diff --git a/sql/handler.h b/sql/handler.h
index d38c3da8da1..44255efab98 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -3532,7 +3532,8 @@ class handler :public Sql_alloc
/* this is necessary in many places, e.g. in HANDLER command */
int ha_index_or_rnd_end()
{
- return inited == INDEX ? ha_index_end() : inited == RND ? ha_rnd_end() : 0;
+ return inited == INDEX ? ha_index_end() : inited == RND ? ha_rnd_end() :