summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <sanja@montyprogram.com>2012-02-16 08:49:10 +0200
committerunknown <sanja@montyprogram.com>2012-02-16 08:49:10 +0200
commit607aab9c1d68a3b80bdb52a6c73fd6be1aa52764 (patch)
tree3e608459856b6def8c6067cf6b75af813d931585 /sql
parent764eeeee74f999fe2107fc362236563be0025093 (diff)
downloadmariadb-git-607aab9c1d68a3b80bdb52a6c73fd6be1aa52764.tar.gz
Counters for Index Condition Pushdown added (MDEV-130).
Diffstat (limited to 'sql')
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/sql_class.h2
-rw-r--r--sql/sql_join_cache.cc22
-rw-r--r--sql/sql_join_cache.h2
4 files changed, 26 insertions, 2 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 109d0220a4a..4e2fa473b8d 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -8291,6 +8291,8 @@ SHOW_VAR status_vars[]= {
{"Handler_mrr_init", (char*) offsetof(STATUS_VAR, ha_multi_range_read_init_count), SHOW_LONG_STATUS},
#endif
{"Handler_prepare", (char*) offsetof(STATUS_VAR, ha_prepare_count), SHOW_LONG_STATUS},
+ {"Handler_pushed_index_cond_checks",(char*) offsetof(STATUS_VAR, ha_pushed_index_cond_checks), SHOW_LONG_STATUS},
+ {"Handler_pushed_index_cond_filtered",(char*) offsetof(STATUS_VAR, ha_pushed_index_cond_filtered), SHOW_LONG_STATUS},
{"Handler_read_first", (char*) offsetof(STATUS_VAR, ha_read_first_count), SHOW_LONG_STATUS},
{"Handler_read_key", (char*) offsetof(STATUS_VAR, ha_read_key_count), SHOW_LONG_STATUS},
{"Handler_read_next", (char*) offsetof(STATUS_VAR, ha_read_next_count), SHOW_LONG_STATUS},
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 58af7888385..c04af55a127 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -588,6 +588,8 @@ typedef struct system_status_var
ulong ha_tmp_update_count;
ulong ha_tmp_write_count;
ulong ha_prepare_count;
+ ulong ha_pushed_index_cond_checks;
+ ulong ha_pushed_index_cond_filtered;
ulong ha_discover_count;
ulong ha_savepoint_count;
ulong ha_savepoint_rollback_count;
diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc
index 78f95a7ac7e..15b5efbfacb 100644
--- a/sql/sql_join_cache.cc
+++ b/sql/sql_join_cache.cc
@@ -2576,6 +2576,15 @@ void JOIN_CACHE::print_explain_comment(String *str)
str->append(STRING_WITH_LEN(")"));
}
+/**
+ get thread handle.
+*/
+
+THD *JOIN_CACHE::thd()
+{
+ return join->thd;
+}
+
static void add_mrr_explain_info(String *str, uint mrr_mode, handler *file)
{
@@ -4015,7 +4024,11 @@ bool bka_skip_index_tuple(range_seq_t rseq, range_id_t range_info)
{
DBUG_ENTER("bka_skip_index_tuple");
JOIN_CACHE_BKA *cache= (JOIN_CACHE_BKA *) rseq;
- bool res= cache->skip_index_tuple(range_info);
+ THD *thd= cache->thd();
+ bool res;
+ status_var_increment(thd->status_var.ha_pushed_index_cond_checks);
+ if ((res= cache->skip_index_tuple(range_info)))
+ status_var_increment(thd->status_var.ha_pushed_index_cond_filtered);
DBUG_RETURN(res);
}
@@ -4490,7 +4503,12 @@ bool bkah_skip_index_tuple(range_seq_t rseq, range_id_t range_info)
{
DBUG_ENTER("bka_unique_skip_index_tuple");
JOIN_CACHE_BKAH *cache= (JOIN_CACHE_BKAH *) rseq;
- DBUG_RETURN(cache->skip_index_tuple(range_info));
+ THD *thd= cache->thd();
+ bool res;
+ status_var_increment(thd->status_var.ha_pushed_index_cond_checks);
+ if ((res= cache->skip_index_tuple(range_info)))
+ status_var_increment(thd->status_var.ha_pushed_index_cond_filtered);
+ DBUG_RETURN(res);
}
diff --git a/sql/sql_join_cache.h b/sql/sql_join_cache.h
index f5d64d5530a..ba8e4ba8e4a 100644
--- a/sql/sql_join_cache.h
+++ b/sql/sql_join_cache.h
@@ -643,6 +643,8 @@ public:
/* Add a comment on the join algorithm employed by the join cache */
virtual void print_explain_comment(String *str);
+ THD *thd();
+
virtual ~JOIN_CACHE() {}
void reset_join(JOIN *j) { join= j; }
void free()