Commit b908f410 authored by heikki@donna.mysql.fi's avatar heikki@donna.mysql.fi
Browse files

ha_innobase.cc:

  Assume selectivity of any key prefix is better than 1 / 100, regardless of what the estimator returns; this balances the pessimistic assumption of the optimizer thatany secondary key access to the full row incurs a page read from disk
parent 6202aa7c
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -3130,6 +3130,22 @@ ha_innobase::info(
					rec_per_key = 1;
				}
			
				/* Since the MySQL optimizer is often too
				pessimistic in the assumption that a table
				does not fit in the buffer pool, we
				increase the attractiveness of indexes
				by assuming the selectivity of any prefix
				of an index is 1 / 100 or better.
				(Actually, we should look at the table
				size, and if the table is smaller than
				the buffer pool, we should uniformly
				increase the attractiveness of indexes,
				regardless of the estimated selectivity.) */

			        if (rec_per_key > records / 100) {
				        rec_per_key = records / 100;
				}

				table->key_info[i].rec_per_key[j]
								= rec_per_key;
			}