Commit 2162408b authored by heikki@hundin.mysql.fi's avatar heikki@hundin.mysql.fi
Browse files

btr0cur.c:

  Backport from 4.0: Fix a major bug in InnoDB query estimator for queries of type SELECT ... WHERE col < x and SELECT ... WHERE col > x; MySQL could pick a table scan though the result set was only a few rows in a big table
parent 29fafced
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -577,12 +577,12 @@ btr_cur_open_at_index_side(
			page_cur_set_after_last(page, page_cursor);
		}

		if (height == 0) {
		        if (estimate) {
			btr_cur_add_path_info(cursor, height, root_height);
			        btr_cur_add_path_info(cursor, height,
						      root_height);
		        }

		if (height == 0) {

			break;
		}

@@ -594,6 +594,10 @@ btr_cur_open_at_index_side(
			page_cur_move_to_prev(page_cursor);
		}

		if (estimate) {
			btr_cur_add_path_info(cursor, height, root_height);
		}

		height--;

		node_ptr = page_cur_get_rec(page_cursor);