diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index fd0ed4cb232..8bf1b403ac3 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -3310,6 +3310,7 @@ btr_cur_prefetch_siblings(
 	}
 }
 
+extern "C" LEX_STRING* thd_query_string(MYSQL_THD thd);
 /*************************************************************//**
 Tries to perform an insert to a page in an index tree, next to cursor.
 It is assumed that mtr holds an x-latch on the page. The operation does
@@ -3575,6 +3576,13 @@ btr_cur_optimistic_insert(
 	}
 #endif /* BTR_CUR_HASH_ADAPT */
 
+	if (!index->is_primary() && thr && thr->graph->trx->mysql_thd) {
+		ib::info() << "insert "
+			   << rec_printer(entry).str() << " by "
+			   << ib::hex(thr->graph->trx->id) << ","
+			   << thd_query_string(thr->graph->trx->mysql_thd)->str;
+	}
+
 	if (!(flags & BTR_NO_LOCKING_FLAG) && inherit) {
 
 		lock_update_insert(block, *rec);
@@ -4267,6 +4275,12 @@ btr_cur_update_in_place(
 	}
 #endif /* BTR_CUR_HASH_ADAPT */
 
+	if (!index->is_primary() && thr->graph->trx->mysql_thd) {
+		ib::info() << "uip " << rec_printer(rec, offsets).str()
+			   << " by " << ib::hex(thr->graph->trx->id) << ","
+			   << thd_query_string(thr->graph->trx->mysql_thd)->str;
+	}
+
 	btr_cur_update_in_place_log(flags, rec, index, update,
 				    trx_id, roll_ptr, mtr);
 
@@ -4671,6 +4685,14 @@ btr_cur_optimistic_update(
 		btr_search_update_hash_on_delete(cursor);
 	}
 
+	if (!index->is_primary() && thr->graph->trx->mysql_thd) {
+		ib::info() << "update "
+			   << rec_printer(page_cursor->rec, *offsets).str()
+			   << " to " << rec_printer(new_entry).str() << " by "
+			   << ib::hex(thr->graph->trx->id) << ","
+			   << thd_query_string(thr->graph->trx->mysql_thd)->str;
+	}
+
 	page_cur_delete_rec(page_cursor, index, *offsets, mtr);
 
 	page_cur_move_to_prev(page_cursor);
