Skip to content

Instantly share code, notes, and snippets.

@spetrunia
Created February 27, 2024 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spetrunia/90032801478118d9c9eb4c918e1a3881 to your computer and use it in GitHub Desktop.
Save spetrunia/90032801478118d9c9eb4c918e1a3881 to your computer and use it in GitHub Desktop.
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index a62aa1c158b..0c42ebb4892 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -8129,6 +8129,8 @@ best_access_path(JOIN *join,
if (table->opt_range[key].key_parts >= max_key_part) // (2)
{
double rows= (double) table->opt_range[key].rows;
+ // psergey: make records optimistic:
+ records= rows/2;
if (!found_ref && // (1)
records < rows) // (3)
{
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index d2b6bd62520..5addf00171b 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -14254,6 +14254,18 @@ ha_innobase::records_in_range(
mem_heap_t* heap;
DBUG_ENTER("records_in_range");
+ //psergey
+ if (!strcmp(table->s->table_name.str, "action_integer"))
+ {
+ if (!strcmp(table->key_info[keynr].name.str, "type_e_integer_index"))
+ DBUG_RETURN(2005818);
+ if (!strcmp(table->key_info[keynr].name.str, "type_element_id_event_date_index"))
+ DBUG_RETURN(11593995);
+ if (!strcmp(table->key_info[keynr].name.str, "event_date_type_e_integer_index"))
+ DBUG_RETURN(894846);
+ if (!strcmp(table->key_info[keynr].name.str, "event_date_index"))
+ DBUG_RETURN(965898);
+ }
ut_a(m_prebuilt->trx == thd_to_trx(ha_thd()));
@@ -14779,6 +14791,11 @@ ha_innobase::info_low(
ut_a(ib_table->stat_initialized);
n_rows = ib_table->stat_n_rows;
+ if (!strcmp(table->s->table_name.str, "action_integer"))
+ {
+ n_rows= ib_table->stat_n_rows= 23187991;
+ ib_table->stat_clustered_index_size= 204544;
+ }
stat_clustered_index_size
= ib_table->stat_clustered_index_size;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment