diff --git a/sql/handler.cc b/sql/handler.cc
index decc9cfd8b4..fd5de29d70b 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -7872,3 +7872,15 @@ Table_scope_and_contents_source_st::fix_period_fields(THD *thd,
   }
   return false;
 }
+
+
+void handler::start_operations_batch()
+{
+  //
+}
+
+void handler::end_operations_batch()
+{
+  //
+}
+
diff --git a/sql/handler.h b/sql/handler.h
index d7559a21445..920a3545c8f 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -3208,6 +3208,9 @@ class handler :public Sql_alloc
     end_range= NULL;
     DBUG_RETURN(result);
   }
+
+  virtual void start_operations_batch();
+  virtual void end_operations_batch();
   int ha_rnd_end()
   {
     DBUG_ENTER("ha_rnd_end");
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index d2e511b1d86..f4875576017 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -650,6 +650,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
       !table_list->has_period())
   {
     table->mark_columns_needed_for_delete();
+    table->file->start_operations_batch(); // psergey
     if (!table->check_virtual_columns_marked_for_read())
     {
       DBUG_PRINT("info", ("Trying direct delete"));
@@ -667,10 +668,12 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
         THD_STAGE_INFO(thd, stage_updating);
         if (!(error= table->file->ha_direct_delete_rows(&deleted)))
           error= -1;
+        table->file->end_operations_batch(); // psergey
         goto terminate_delete;
       }
     }
   }
+  table->file->end_operations_batch(); // psergey
 
   if (query_plan.using_filesort)
   {
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index c619cd4e066..c8eb0a0de33 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -20021,6 +20021,13 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records)
   if (join_tab->loosescan_match_tab)
     join_tab->loosescan_match_tab->found_match= FALSE;
 
+  bool ops_batch_started= false; // psergey
+  if (join_tab->next_select == end_send)
+  {
+    join_tab->table->file->start_operations_batch();
+    ops_batch_started= true;
+  }
+
   if (rc != NESTED_LOOP_NO_MORE_ROWS)
   {
     error= (*join_tab->read_first_record)(join_tab);
@@ -20068,6 +20075,9 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records)
     rc= evaluate_join_record(join, join_tab, error);
   }
 
+  if (ops_batch_started)
+    join_tab->table->file->end_operations_batch();
+
   if (rc == NESTED_LOOP_NO_MORE_ROWS &&
       join_tab->last_inner && !join_tab->found)
     rc= evaluate_null_complemented_join_record(join, join_tab);
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 775a77c82d2..f051a8c73b5 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -369,6 +369,7 @@ int mysql_update(THD *thd,
   TABLE_LIST *update_source_table;
   query_plan.index= MAX_KEY;
   query_plan.using_filesort= FALSE;
+  bool ops_batch_started= false;
 
   // For System Versioning (may need to insert new fields to a table).
   ha_rows rows_inserted= 0;
@@ -730,6 +731,8 @@ int mysql_update(THD *thd,
 
       note: We avoid sorting if we sort on the used index
     */
+    table->file->start_operations_batch(); // psergey
+    ops_batch_started= true;
     if (query_plan.using_filesort)
     {
       /*
@@ -880,6 +883,8 @@ int mysql_update(THD *thd,
       table->file->ha_end_keyread();
       table->column_bitmaps_set(save_read_set, save_write_set);
     }
+    table->file->end_operations_batch(); // psergey
+    ops_batch_started= false;
   }
 
 update_begin:
@@ -936,6 +941,8 @@ int mysql_update(THD *thd,
   explain->tracker.on_scan_init();
 
   THD_STAGE_INFO(thd, stage_updating);
+  table->file->start_operations_batch(); // psergey
+  ops_batch_started= true;
   while (!(error=info.read_record()) && !thd->killed)
   {
     if (table->versioned() && !table->vers_end_field()->is_max())
@@ -1152,6 +1159,9 @@ int mysql_update(THD *thd,
       break;
     }
   }
+  table->file->end_operations_batch(); // psergey
+  ops_batch_started= false;
+
   ANALYZE_STOP_TRACKING(&explain->command_tracker);
   table->auto_increment_field_not_null= FALSE;
   dup_key_found= 0;
@@ -1297,6 +1307,9 @@ int mysql_update(THD *thd,
   DBUG_RETURN((error >= 0 || thd->is_error()) ? 1 : 0);
 
 err:
+  if (ops_batch_started)
+    table->file->end_operations_batch(); // psergey
+
   delete select;
   delete file_sort;
   free_underlaid_joins(thd, select_lex);
