List:Commits« Previous MessageNext Message »
From:Jorgen Loland Date:June 5 2012 7:13am
Subject:bzr push into mysql-trunk branch (jorgen.loland:3948 to 3949)
View as plain text  
 3949 Jorgen Loland	2012-06-05
      Optimizer trace: 
       * Fixed: Wrong cost was printed for table scan in the 
         chosen_range_access_summary section
       * Added: Whether DsMRR is chosen is now printed (like in 
         EXPLAIN it says "using_mrr=true" if DsMRR is chosen,
         "using_mrr=false" otherwise.

    modified:
      mysql-test/suite/opt_trace/r/bugs_no_prot_all.result
      mysql-test/suite/opt_trace/r/bugs_no_prot_none.result
      mysql-test/suite/opt_trace/r/bugs_ps_prot_all.result
      mysql-test/suite/opt_trace/r/bugs_ps_prot_none.result
      mysql-test/suite/opt_trace/r/charset.result
      mysql-test/suite/opt_trace/r/eq_range_statistics.result
      mysql-test/suite/opt_trace/r/filesort_pq.result
      mysql-test/suite/opt_trace/r/general2_no_prot.result
      mysql-test/suite/opt_trace/r/general2_ps_prot.result
      mysql-test/suite/opt_trace/r/general_no_prot_all.result
      mysql-test/suite/opt_trace/r/general_no_prot_none.result
      mysql-test/suite/opt_trace/r/general_ps_prot_all.result
      mysql-test/suite/opt_trace/r/general_ps_prot_none.result
      mysql-test/suite/opt_trace/r/range_no_prot.result
      mysql-test/suite/opt_trace/r/range_ps_prot.result
      mysql-test/suite/opt_trace/r/subquery_no_prot.result
      mysql-test/suite/opt_trace/r/subquery_ps_prot.result
      mysql-test/suite/opt_trace/r/temp_table.result
      sql/opt_range.cc
      sql/sql_planner.cc
 3948 Anitha Gopi	2012-06-05
      Bug#13418338 : Modify README file to include the same comments as MTR user doc regarding collections

    modified:
      mysql-test/collections/README
=== modified file 'mysql-test/suite/opt_trace/r/bugs_no_prot_all.result'
--- a/mysql-test/suite/opt_trace/r/bugs_no_prot_all.result	2012-05-23 15:13:27 +0000
+++ b/mysql-test/suite/opt_trace/r/bugs_no_prot_all.result	2012-06-05 07:13:40 +0000
@@ -539,7 +539,7 @@ FROM t1
                           {
                             "access_type": "scan",
                             "rows": 1,
-                            "cost": 2.0049,
+                            "cost": 2.2049,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -565,7 +565,7 @@ FROM t1
                     {
                       "access_type": "scan",
                       "rows": 1,
-                      "cost": 2.0049,
+                      "cost": 2.2049,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -906,7 +906,7 @@ ON table2 .col_int_key = table1 .col_int
                                           {
                                             "access_type": "scan",
                                             "rows": 4,
-                                            "cost": 2.0068,
+                                            "cost": 2.8068,
                                             "chosen": true
                                           }
                                         ] /* considered_access_paths */
@@ -992,7 +992,7 @@ ON table2 .col_int_key = table1 .col_int
                                           {
                                             "access_type": "scan",
                                             "rows": 4,
-                                            "cost": 2.0068,
+                                            "cost": 2.8068,
                                             "chosen": true
                                           }
                                         ] /* considered_access_paths */
@@ -1145,7 +1145,7 @@ ON table2 .col_int_key = table1 .col_int
                           {
                             "access_type": "scan",
                             "rows": 4,
-                            "cost": 2.0068,
+                            "cost": 2.8068,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -1171,7 +1171,7 @@ ON table2 .col_int_key = table1 .col_int
                                 "access_type": "scan",
                                 "using_join_cache": true,
                                 "rows": 3,
-                                "cost": 2.2071,
+                                "cost": 4.6071,
                                 "chosen": true
                               }
                             ] /* considered_access_paths */
@@ -1197,7 +1197,7 @@ ON table2 .col_int_key = table1 .col_int
                           {
                             "access_type": "scan",
                             "rows": 4,
-                            "cost": 2.0068,
+                            "cost": 2.8068,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -1223,7 +1223,7 @@ ON table2 .col_int_key = table1 .col_int
                                 "access_type": "scan",
                                 "using_join_cache": true,
                                 "rows": 3,
-                                "cost": 2.2071,
+                                "cost": 4.6071,
                                 "chosen": true
                               }
                             ] /* considered_access_paths */
@@ -1250,7 +1250,7 @@ ON table2 .col_int_key = table1 .col_int
                     {
                       "access_type": "scan",
                       "rows": 6,
-                      "cost": 2.019,
+                      "cost": 3.219,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -1278,7 +1278,7 @@ ON table2 .col_int_key = table1 .col_int
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 3,
-                          "cost": 2.208,
+                          "cost": 5.808,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -1307,7 +1307,7 @@ ON table2 .col_int_key = table1 .col_int
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 3,
-                              "cost": 2.2118,
+                              "cost": 13.012,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -1333,7 +1333,7 @@ ON table2 .col_int_key = table1 .col_int
                                       {
                                         "access_type": "scan",
                                         "rows": 3,
-                                        "cost": 13.241,
+                                        "cost": 16.841,
                                         "chosen": false
                                       }
                                     ] /* considered_access_paths */
@@ -1353,7 +1353,7 @@ ON table2 .col_int_key = table1 .col_int
                                       {
                                         "access_type": "scan",
                                         "rows": 3,
-                                        "cost": 26.482,
+                                        "cost": 33.682,
                                         "chosen": false
                                       }
                                     ] /* considered_access_paths */
@@ -1402,7 +1402,7 @@ ON table2 .col_int_key = table1 .col_int
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 3,
-                          "cost": 2.208,
+                          "cost": 5.808,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -1431,7 +1431,7 @@ ON table2 .col_int_key = table1 .col_int
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 3,
-                              "cost": 2.2118,
+                              "cost": 13.012,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -1457,7 +1457,7 @@ ON table2 .col_int_key = table1 .col_int
                                       {
                                         "access_type": "scan",
                                         "rows": 3,
-                                        "cost": 13.241,
+                                        "cost": 16.841,
                                         "chosen": false
                                       }
                                     ] /* considered_access_paths */
@@ -1477,7 +1477,7 @@ ON table2 .col_int_key = table1 .col_int
                                       {
                                         "access_type": "scan",
                                         "rows": 3,
-                                        "cost": 26.482,
+                                        "cost": 33.682,
                                         "chosen": false
                                       }
                                     ] /* considered_access_paths */
@@ -1525,7 +1525,7 @@ ON table2 .col_int_key = table1 .col_int
                     {
                       "access_type": "scan",
                       "rows": 4,
-                      "cost": 2.0068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -1546,7 +1546,7 @@ ON table2 .col_int_key = table1 .col_int
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 6,
-                          "cost": 2.0194,
+                          "cost": 6.8194,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -1575,7 +1575,7 @@ ON table2 .col_int_key = table1 .col_int
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 3,
-                              "cost": 2.2135,
+                              "cost": 16.613,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -1613,7 +1613,7 @@ ON table2 .col_int_key = table1 .col_int
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 3,
-                          "cost": 2.2071,
+                          "cost": 4.6071,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -1635,7 +1635,7 @@ ON table2 .col_int_key = table1 .col_int
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 6,
-                              "cost": 2.0209,
+                              "cost": 16.421,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -1673,7 +1673,7 @@ ON table2 .col_int_key = table1 .col_int
                     {
                       "access_type": "scan",
                       "rows": 4,
-                      "cost": 2.0068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -1694,7 +1694,7 @@ ON table2 .col_int_key = table1 .col_int
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 6,
-                          "cost": 2.0194,
+                          "cost": 6.8194,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -1723,7 +1723,7 @@ ON table2 .col_int_key = table1 .col_int
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 3,
-                              "cost": 2.2135,
+                              "cost": 16.613,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -1761,7 +1761,7 @@ ON table2 .col_int_key = table1 .col_int
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 3,
-                          "cost": 2.2071,
+                          "cost": 4.6071,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -1783,7 +1783,7 @@ ON table2 .col_int_key = table1 .col_int
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 6,
-                              "cost": 2.0209,
+                              "cost": 16.421,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -1850,6 +1850,7 @@ ON table2 .col_int_key = table1 .col_int
                             "rows": 18446744073709551615,
                             "cost": 0,
                             "rowid_ordered": false,
+                            "using_mrr": true,
                             "chosen": false,
                             "cause": "cost"
                           }
@@ -2196,6 +2197,7 @@ SELECT 1 FROM t1 WHERE 1 LIKE
                                     "rows": 1,
                                     "cost": 2.21,
                                     "rowid_ordered": true,
+                                    "using_mrr": true,
                                     "chosen": false,
                                     "cause": "cost"
                                   },
@@ -2209,6 +2211,7 @@ SELECT 1 FROM t1 WHERE 1 LIKE
                                     "rows": 1,
                                     "cost": 2.21,
                                     "rowid_ordered": false,
+                                    "using_mrr": false,
                                     "chosen": false,
                                     "cause": "cost"
                                   }

=== modified file 'mysql-test/suite/opt_trace/r/bugs_no_prot_none.result'
--- a/mysql-test/suite/opt_trace/r/bugs_no_prot_none.result	2012-05-23 15:13:27 +0000
+++ b/mysql-test/suite/opt_trace/r/bugs_no_prot_none.result	2012-06-05 07:13:40 +0000
@@ -882,7 +882,7 @@ ON table2 .col_int_key = table1 .col_int
                     {
                       "access_type": "scan",
                       "rows": 6,
-                      "cost": 2.019,
+                      "cost": 3.219,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -962,7 +962,7 @@ ON table2 .col_int_key = table1 .col_int
                                 {
                                   "access_type": "scan",
                                   "rows": 4,
-                                  "cost": 2.0068,
+                                  "cost": 2.8068,
                                   "chosen": true
                                 }
                               ] /* considered_access_paths */
@@ -1092,7 +1092,7 @@ ON table2 .col_int_key = table1 .col_int
                                                       {
                                                         "access_type": "scan",
                                                         "rows": 4,
-                                                        "cost": 2.0068,
+                                                        "cost": 2.8068,
                                                         "chosen": true
                                                       }
                                                     ] /* considered_access_paths */
@@ -1224,7 +1224,7 @@ ON table2 .col_int_key = table1 .col_int
                                 },
                                 {
                                   "access_type": "scan",
-                                  "cost": 2,
+                                  "cost": 2.8,
                                   "rows": 4,
                                   "cause": "cost",
                                   "chosen": false
@@ -1252,7 +1252,7 @@ ON table2 .col_int_key = table1 .col_int
                                       "access_type": "scan",
                                       "using_join_cache": true,
                                       "rows": 3,
-                                      "cost": 2.207,
+                                      "cost": 3.407,
                                       "chosen": false
                                     }
                                   ] /* considered_access_paths */
@@ -1278,7 +1278,7 @@ ON table2 .col_int_key = table1 .col_int
                                 },
                                 {
                                   "access_type": "scan",
-                                  "cost": 2,
+                                  "cost": 2.8,
                                   "rows": 4,
                                   "cause": "cost",
                                   "chosen": false
@@ -1306,7 +1306,7 @@ ON table2 .col_int_key = table1 .col_int
                                       "access_type": "scan",
                                       "using_join_cache": true,
                                       "rows": 3,
-                                      "cost": 2.207,
+                                      "cost": 3.407,
                                       "chosen": false
                                     }
                                   ] /* considered_access_paths */
@@ -1637,6 +1637,7 @@ SELECT 1 FROM t1 WHERE 1 LIKE
                                     "rows": 1,
                                     "cost": 2.21,
                                     "rowid_ordered": true,
+                                    "using_mrr": false,
                                     "chosen": false,
                                     "cause": "cost"
                                   },
@@ -1650,6 +1651,7 @@ SELECT 1 FROM t1 WHERE 1 LIKE
                                     "rows": 1,
                                     "cost": 2.21,
                                     "rowid_ordered": false,
+                                    "using_mrr": false,
                                     "chosen": false,
                                     "cause": "cost"
                                   }

=== modified file 'mysql-test/suite/opt_trace/r/bugs_ps_prot_all.result'
--- a/mysql-test/suite/opt_trace/r/bugs_ps_prot_all.result	2012-05-23 15:13:27 +0000
+++ b/mysql-test/suite/opt_trace/r/bugs_ps_prot_all.result	2012-06-05 07:13:40 +0000
@@ -539,7 +539,7 @@ FROM t1
                           {
                             "access_type": "scan",
                             "rows": 1,
-                            "cost": 2.0049,
+                            "cost": 2.2049,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -565,7 +565,7 @@ FROM t1
                     {
                       "access_type": "scan",
                       "rows": 1,
-                      "cost": 2.0049,
+                      "cost": 2.2049,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -906,7 +906,7 @@ ON table2 .col_int_key = table1 .col_int
                                           {
                                             "access_type": "scan",
                                             "rows": 4,
-                                            "cost": 2.0068,
+                                            "cost": 2.8068,
                                             "chosen": true
                                           }
                                         ] /* considered_access_paths */
@@ -992,7 +992,7 @@ ON table2 .col_int_key = table1 .col_int
                                           {
                                             "access_type": "scan",
                                             "rows": 4,
-                                            "cost": 2.0068,
+                                            "cost": 2.8068,
                                             "chosen": true
                                           }
                                         ] /* considered_access_paths */
@@ -1145,7 +1145,7 @@ ON table2 .col_int_key = table1 .col_int
                           {
                             "access_type": "scan",
                             "rows": 4,
-                            "cost": 2.0068,
+                            "cost": 2.8068,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -1171,7 +1171,7 @@ ON table2 .col_int_key = table1 .col_int
                                 "access_type": "scan",
                                 "using_join_cache": true,
                                 "rows": 3,
-                                "cost": 2.2071,
+                                "cost": 4.6071,
                                 "chosen": true
                               }
                             ] /* considered_access_paths */
@@ -1197,7 +1197,7 @@ ON table2 .col_int_key = table1 .col_int
                           {
                             "access_type": "scan",
                             "rows": 4,
-                            "cost": 2.0068,
+                            "cost": 2.8068,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -1223,7 +1223,7 @@ ON table2 .col_int_key = table1 .col_int
                                 "access_type": "scan",
                                 "using_join_cache": true,
                                 "rows": 3,
-                                "cost": 2.2071,
+                                "cost": 4.6071,
                                 "chosen": true
                               }
                             ] /* considered_access_paths */
@@ -1250,7 +1250,7 @@ ON table2 .col_int_key = table1 .col_int
                     {
                       "access_type": "scan",
                       "rows": 6,
-                      "cost": 2.019,
+                      "cost": 3.219,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -1278,7 +1278,7 @@ ON table2 .col_int_key = table1 .col_int
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 3,
-                          "cost": 2.208,
+                          "cost": 5.808,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -1307,7 +1307,7 @@ ON table2 .col_int_key = table1 .col_int
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 3,
-                              "cost": 2.2118,
+                              "cost": 13.012,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -1333,7 +1333,7 @@ ON table2 .col_int_key = table1 .col_int
                                       {
                                         "access_type": "scan",
                                         "rows": 3,
-                                        "cost": 13.241,
+                                        "cost": 16.841,
                                         "chosen": false
                                       }
                                     ] /* considered_access_paths */
@@ -1353,7 +1353,7 @@ ON table2 .col_int_key = table1 .col_int
                                       {
                                         "access_type": "scan",
                                         "rows": 3,
-                                        "cost": 26.482,
+                                        "cost": 33.682,
                                         "chosen": false
                                       }
                                     ] /* considered_access_paths */
@@ -1402,7 +1402,7 @@ ON table2 .col_int_key = table1 .col_int
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 3,
-                          "cost": 2.208,
+                          "cost": 5.808,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -1431,7 +1431,7 @@ ON table2 .col_int_key = table1 .col_int
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 3,
-                              "cost": 2.2118,
+                              "cost": 13.012,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -1457,7 +1457,7 @@ ON table2 .col_int_key = table1 .col_int
                                       {
                                         "access_type": "scan",
                                         "rows": 3,
-                                        "cost": 13.241,
+                                        "cost": 16.841,
                                         "chosen": false
                                       }
                                     ] /* considered_access_paths */
@@ -1477,7 +1477,7 @@ ON table2 .col_int_key = table1 .col_int
                                       {
                                         "access_type": "scan",
                                         "rows": 3,
-                                        "cost": 26.482,
+                                        "cost": 33.682,
                                         "chosen": false
                                       }
                                     ] /* considered_access_paths */
@@ -1525,7 +1525,7 @@ ON table2 .col_int_key = table1 .col_int
                     {
                       "access_type": "scan",
                       "rows": 4,
-                      "cost": 2.0068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -1546,7 +1546,7 @@ ON table2 .col_int_key = table1 .col_int
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 6,
-                          "cost": 2.0194,
+                          "cost": 6.8194,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -1575,7 +1575,7 @@ ON table2 .col_int_key = table1 .col_int
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 3,
-                              "cost": 2.2135,
+                              "cost": 16.613,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -1613,7 +1613,7 @@ ON table2 .col_int_key = table1 .col_int
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 3,
-                          "cost": 2.2071,
+                          "cost": 4.6071,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -1635,7 +1635,7 @@ ON table2 .col_int_key = table1 .col_int
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 6,
-                              "cost": 2.0209,
+                              "cost": 16.421,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -1673,7 +1673,7 @@ ON table2 .col_int_key = table1 .col_int
                     {
                       "access_type": "scan",
                       "rows": 4,
-                      "cost": 2.0068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -1694,7 +1694,7 @@ ON table2 .col_int_key = table1 .col_int
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 6,
-                          "cost": 2.0194,
+                          "cost": 6.8194,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -1723,7 +1723,7 @@ ON table2 .col_int_key = table1 .col_int
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 3,
-                              "cost": 2.2135,
+                              "cost": 16.613,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -1761,7 +1761,7 @@ ON table2 .col_int_key = table1 .col_int
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 3,
-                          "cost": 2.2071,
+                          "cost": 4.6071,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -1783,7 +1783,7 @@ ON table2 .col_int_key = table1 .col_int
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 6,
-                              "cost": 2.0209,
+                              "cost": 16.421,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -1850,6 +1850,7 @@ ON table2 .col_int_key = table1 .col_int
                             "rows": 18446744073709551615,
                             "cost": 0,
                             "rowid_ordered": false,
+                            "using_mrr": true,
                             "chosen": false,
                             "cause": "cost"
                           }
@@ -2196,6 +2197,7 @@ SELECT 1 FROM t1 WHERE 1 LIKE
                                     "rows": 1,
                                     "cost": 2.21,
                                     "rowid_ordered": true,
+                                    "using_mrr": true,
                                     "chosen": false,
                                     "cause": "cost"
                                   },
@@ -2209,6 +2211,7 @@ SELECT 1 FROM t1 WHERE 1 LIKE
                                     "rows": 1,
                                     "cost": 2.21,
                                     "rowid_ordered": false,
+                                    "using_mrr": false,
                                     "chosen": false,
                                     "cause": "cost"
                                   }

=== modified file 'mysql-test/suite/opt_trace/r/bugs_ps_prot_none.result'
--- a/mysql-test/suite/opt_trace/r/bugs_ps_prot_none.result	2012-05-23 15:13:27 +0000
+++ b/mysql-test/suite/opt_trace/r/bugs_ps_prot_none.result	2012-06-05 07:13:40 +0000
@@ -862,7 +862,7 @@ ON table2 .col_int_key = table1 .col_int
                     {
                       "access_type": "scan",
                       "rows": 6,
-                      "cost": 2.019,
+                      "cost": 3.219,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -942,7 +942,7 @@ ON table2 .col_int_key = table1 .col_int
                                 {
                                   "access_type": "scan",
                                   "rows": 4,
-                                  "cost": 2.0068,
+                                  "cost": 2.8068,
                                   "chosen": true
                                 }
                               ] /* considered_access_paths */
@@ -1072,7 +1072,7 @@ ON table2 .col_int_key = table1 .col_int
                                                       {
                                                         "access_type": "scan",
                                                         "rows": 4,
-                                                        "cost": 2.0068,
+                                                        "cost": 2.8068,
                                                         "chosen": true
                                                       }
                                                     ] /* considered_access_paths */
@@ -1204,7 +1204,7 @@ ON table2 .col_int_key = table1 .col_int
                                 },
                                 {
                                   "access_type": "scan",
-                                  "cost": 2,
+                                  "cost": 2.8,
                                   "rows": 4,
                                   "cause": "cost",
                                   "chosen": false
@@ -1232,7 +1232,7 @@ ON table2 .col_int_key = table1 .col_int
                                       "access_type": "scan",
                                       "using_join_cache": true,
                                       "rows": 3,
-                                      "cost": 2.207,
+                                      "cost": 3.407,
                                       "chosen": false
                                     }
                                   ] /* considered_access_paths */
@@ -1258,7 +1258,7 @@ ON table2 .col_int_key = table1 .col_int
                                 },
                                 {
                                   "access_type": "scan",
-                                  "cost": 2,
+                                  "cost": 2.8,
                                   "rows": 4,
                                   "cause": "cost",
                                   "chosen": false
@@ -1286,7 +1286,7 @@ ON table2 .col_int_key = table1 .col_int
                                       "access_type": "scan",
                                       "using_join_cache": true,
                                       "rows": 3,
-                                      "cost": 2.207,
+                                      "cost": 3.407,
                                       "chosen": false
                                     }
                                   ] /* considered_access_paths */
@@ -1617,6 +1617,7 @@ SELECT 1 FROM t1 WHERE 1 LIKE
                                     "rows": 1,
                                     "cost": 2.21,
                                     "rowid_ordered": true,
+                                    "using_mrr": false,
                                     "chosen": false,
                                     "cause": "cost"
                                   },
@@ -1630,6 +1631,7 @@ SELECT 1 FROM t1 WHERE 1 LIKE
                                     "rows": 1,
                                     "cost": 2.21,
                                     "rowid_ordered": false,
+                                    "using_mrr": false,
                                     "chosen": false,
                                     "cause": "cost"
                                   }

=== modified file 'mysql-test/suite/opt_trace/r/charset.result'
--- a/mysql-test/suite/opt_trace/r/charset.result	2012-03-28 13:39:57 +0000
+++ b/mysql-test/suite/opt_trace/r/charset.result	2012-06-05 07:13:40 +0000
@@ -431,6 +431,7 @@ select * from t1 where c < 'ÁÂÃÄÅ'	
                         "rows": 2,
                         "cost": 3.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -455,7 +456,7 @@ select * from t1 where c < 'ÁÂÃÄÅ'	
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0034,
+                      "cost": 2.4034,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -632,6 +633,7 @@ select `col
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -656,7 +658,7 @@ select `col
                     {
                       "access_type": "scan",
                       "rows": 1,
-                      "cost": 2.2034,
+                      "cost": 2.4034,
                       "chosen": true
                     }
                   ] /* considered_access_paths */

=== modified file 'mysql-test/suite/opt_trace/r/eq_range_statistics.result'
--- a/mysql-test/suite/opt_trace/r/eq_range_statistics.result	2012-03-28 13:39:57 +0000
+++ b/mysql-test/suite/opt_trace/r/eq_range_statistics.result	2012-06-05 07:13:40 +0000
@@ -154,6 +154,7 @@ EXPLAIN SELECT * FROM t1 WHERE a=5 OR a>
                         "rows": 5,
                         "cost": 2.139,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       }
                     ] /* range_scan_alternatives */,
@@ -192,7 +193,7 @@ EXPLAIN SELECT * FROM t1 WHERE a=5 OR a>
                     {
                       "access_type": "range",
                       "rows": 5,
-                      "cost": 2.139,
+                      "cost": 3.139,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -339,6 +340,7 @@ EXPLAIN SELECT * FROM t1 WHERE a=5 OR a>
                         "rows": 7,
                         "cost": 2.6035,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       }
                     ] /* range_scan_alternatives */,
@@ -378,7 +380,7 @@ EXPLAIN SELECT * FROM t1 WHERE a=5 OR a>
                     {
                       "access_type": "range",
                       "rows": 7,
-                      "cost": 2.6035,
+                      "cost": 4.0035,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -531,6 +533,7 @@ EXPLAIN SELECT * FROM t1 WHERE a=5 AND (
                         "rows": 3,
                         "cost": 1.6745,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       }
                     ] /* range_scan_alternatives */,
@@ -576,7 +579,7 @@ EXPLAIN SELECT * FROM t1 WHERE a=5 AND (
                     {
                       "access_type": "range",
                       "rows": 3,
-                      "cost": 1.6745,
+                      "cost": 2.2745,
                       "chosen": false
                     }
                   ] /* considered_access_paths */
@@ -738,6 +741,7 @@ EXPLAIN SELECT * FROM t1 WHERE a=5 AND (
                         "rows": 3,
                         "cost": 1.6745,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       }
                     ] /* range_scan_alternatives */,
@@ -783,7 +787,7 @@ EXPLAIN SELECT * FROM t1 WHERE a=5 AND (
                     {
                       "access_type": "range",
                       "rows": 3,
-                      "cost": 1.6745,
+                      "cost": 2.2745,
                       "chosen": false
                     }
                   ] /* considered_access_paths */
@@ -944,6 +948,7 @@ EXPLAIN SELECT * FROM t1 WHERE a=5 AND (
                         "rows": 3,
                         "cost": 1.6745,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       }
                     ] /* range_scan_alternatives */,
@@ -989,7 +994,7 @@ EXPLAIN SELECT * FROM t1 WHERE a=5 AND (
                     {
                       "access_type": "range",
                       "rows": 3,
-                      "cost": 1.6745,
+                      "cost": 2.2745,
                       "chosen": false
                     }
                   ] /* considered_access_paths */
@@ -1144,6 +1149,7 @@ EXPLAIN SELECT * FROM t1 WHERE a>5 AND (
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       }
                     ] /* range_scan_alternatives */,
@@ -1182,7 +1188,7 @@ EXPLAIN SELECT * FROM t1 WHERE a>5 AND (
                     {
                       "access_type": "range",
                       "rows": 1,
-                      "cost": 2.21,
+                      "cost": 2.41,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -1333,6 +1339,7 @@ EXPLAIN SELECT * FROM t1 WHERE a=5	{
                         "rows": 3,
                         "cost": 1.6745,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       }
                     ] /* range_scan_alternatives */,

=== modified file 'mysql-test/suite/opt_trace/r/filesort_pq.result'
--- a/mysql-test/suite/opt_trace/r/filesort_pq.result	2012-05-31 16:21:37 +0000
+++ b/mysql-test/suite/opt_trace/r/filesort_pq.result	2012-06-05 07:13:40 +0000
@@ -180,7 +180,7 @@ SELECT * FROM t1 ORDER BY f1 ASC, f0 LIM
                     {
                       "access_type": "scan",
                       "rows": 100,
-                      "cost": 2.4883,
+                      "cost": 22.488,
                       "chosen": true,
                       "use_tmp_table": true
                     }
@@ -357,7 +357,7 @@ SELECT * FROM t1 ORDER BY f1 ASC, f0 LIM
                     {
                       "access_type": "scan",
                       "rows": 100,
-                      "cost": 2.4883,
+                      "cost": 22.488,
                       "chosen": true
                     }
                   ]
@@ -565,7 +565,7 @@ SELECT * FROM t1 ORDER BY f2 DESC, f0 LI
                     {
                       "access_type": "scan",
                       "rows": 100,
-                      "cost": 2.4883,
+                      "cost": 22.488,
                       "chosen": true
                     }
                   ]
@@ -787,7 +787,7 @@ SELECT * FROM t1 WHERE f1>10 ORDER BY f2
                     {
                       "access_type": "scan",
                       "rows": 100,
-                      "cost": 2.4883,
+                      "cost": 22.488,
                       "chosen": true
                     }
                   ]
@@ -1019,7 +1019,7 @@ SELECT * FROM t1 WHERE f1>10 ORDER BY f2
                     {
                       "access_type": "scan",
                       "rows": 100,
-                      "cost": 2.4883,
+                      "cost": 22.488,
                       "chosen": true
                     }
                   ]
@@ -1186,7 +1186,7 @@ SELECT * FROM t1 WHERE f1>10 ORDER BY f2
                     {
                       "access_type": "scan",
                       "rows": 100,
-                      "cost": 2.4883,
+                      "cost": 22.488,
                       "chosen": true
                     }
                   ]
@@ -1331,7 +1331,7 @@ SELECT CONCAT("hello ", f2) AS foo FROM 
                     {
                       "access_type": "scan",
                       "rows": 100,
-                      "cost": 2.4883,
+                      "cost": 22.488,
                       "chosen": true
                     }
                   ]
@@ -1464,7 +1464,7 @@ SELECT * from t1 ORDER BY rand(2) LIMIT 
                     {
                       "access_type": "scan",
                       "rows": 100,
-                      "cost": 2.4883,
+                      "cost": 22.488,
                       "chosen": true
                     }
                   ]
@@ -1642,7 +1642,7 @@ SELECT * FROM t1 ORDER BY f1 ASC, f0 LIM
                     {
                       "access_type": "scan",
                       "rows": 100,
-                      "cost": 2.4883,
+                      "cost": 22.488,
                       "chosen": true
                     }
                   ]
@@ -1850,7 +1850,7 @@ SELECT * FROM t1 ORDER BY f2 DESC, f0 LI
                     {
                       "access_type": "scan",
                       "rows": 100,
-                      "cost": 2.4883,
+                      "cost": 22.488,
                       "chosen": true
                     }
                   ]
@@ -2072,7 +2072,7 @@ SELECT * FROM t1 WHERE f1>10 ORDER BY f2
                     {
                       "access_type": "scan",
                       "rows": 100,
-                      "cost": 2.4883,
+                      "cost": 22.488,
                       "chosen": true
                     }
                   ]
@@ -2304,7 +2304,7 @@ SELECT * FROM t1 WHERE f1>10 ORDER BY f2
                     {
                       "access_type": "scan",
                       "rows": 100,
-                      "cost": 2.4883,
+                      "cost": 22.488,
                       "chosen": true
                     }
                   ]
@@ -2471,7 +2471,7 @@ SELECT * FROM t1 WHERE f1>10 ORDER BY f2
                     {
                       "access_type": "scan",
                       "rows": 100,
-                      "cost": 2.4883,
+                      "cost": 22.488,
                       "chosen": true
                     }
                   ]
@@ -2652,7 +2652,7 @@ ORDER BY f1, f0 LIMIT 30	{
                     {
                       "access_type": "scan",
                       "rows": 100,
-                      "cost": 2.4883,
+                      "cost": 22.488,
                       "chosen": true
                     }
                   ]
@@ -2800,7 +2800,7 @@ ORDER BY f1, f0 LIMIT 0	{
                     {
                       "access_type": "scan",
                       "rows": 100,
-                      "cost": 2.4883,
+                      "cost": 22.488,
                       "chosen": true
                     }
                   ]
@@ -2992,7 +2992,7 @@ ORDER BY f2, f0 LIMIT 20	{
                     {
                       "access_type": "scan",
                       "rows": 100,
-                      "cost": 2.4883,
+                      "cost": 22.488,
                       "chosen": true
                     }
                   ]
@@ -3164,7 +3164,7 @@ ORDER BY f2, f0 LIMIT 0	{
                     {
                       "access_type": "scan",
                       "rows": 100,
-                      "cost": 2.4883,
+                      "cost": 22.488,
                       "chosen": true
                     }
                   ]
@@ -3346,7 +3346,7 @@ ORDER BY f2, f0 LIMIT 10 OFFSET 10	{
                     {
                       "access_type": "scan",
                       "rows": 100,
-                      "cost": 2.4883,
+                      "cost": 22.488,
                       "chosen": true
                     }
                   ]
@@ -3518,7 +3518,7 @@ ORDER BY f2, f0 LIMIT 0 OFFSET 10	{
                     {
                       "access_type": "scan",
                       "rows": 100,
-                      "cost": 2.4883,
+                      "cost": 22.488,
                       "chosen": true
                     }
                   ]
@@ -3748,7 +3748,7 @@ ORDER BY tmp.f1, f0 LIMIT 30	{
                     {
                       "access_type": "scan",
                       "rows": 300,
-                      "cost": 3.4648,
+                      "cost": 63.465,
                       "chosen": true
                     }
                   ]
@@ -3767,7 +3767,7 @@ ORDER BY tmp.f1, f0 LIMIT 30	{
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 500,
-                          "cost": 4.7057,
+                          "cost": 30005,
                           "chosen": true
                         }
                       ]
@@ -3787,7 +3787,7 @@ ORDER BY tmp.f1, f0 LIMIT 30	{
                     {
                       "access_type": "scan",
                       "rows": 500,
-                      "cost": 4.4414,
+                      "cost": 104.44,
                       "chosen": true
                     }
                   ]
@@ -4029,7 +4029,7 @@ ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30	{
                     {
                       "access_type": "scan",
                       "rows": 300,
-                      "cost": 3.4648,
+                      "cost": 63.465,
                       "chosen": true
                     }
                   ]
@@ -4048,7 +4048,7 @@ ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30	{
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 500,
-                          "cost": 4.7057,
+                          "cost": 30005,
                           "chosen": true
                         }
                       ]
@@ -4068,7 +4068,7 @@ ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30	{
                     {
                       "access_type": "scan",
                       "rows": 500,
-                      "cost": 4.4414,
+                      "cost": 104.44,
                       "chosen": true
                     }
                   ]
@@ -4315,7 +4315,7 @@ ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30	{
                     {
                       "access_type": "scan",
                       "rows": 300,
-                      "cost": 3.4648,
+                      "cost": 63.465,
                       "chosen": true
                     }
                   ]
@@ -4334,7 +4334,7 @@ ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30	{
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 500,
-                          "cost": 4.7057,
+                          "cost": 30005,
                           "chosen": true
                         }
                       ]
@@ -4354,7 +4354,7 @@ ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30	{
                     {
                       "access_type": "scan",
                       "rows": 500,
-                      "cost": 4.4414,
+                      "cost": 104.44,
                       "chosen": true
                     }
                   ]
@@ -4629,7 +4629,7 @@ ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30	{
                     {
                       "access_type": "scan",
                       "rows": 300,
-                      "cost": 3.4648,
+                      "cost": 63.465,
                       "chosen": true
                     }
                   ]
@@ -4648,7 +4648,7 @@ ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30	{
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 500,
-                          "cost": 4.7057,
+                          "cost": 30005,
                           "chosen": true
                         }
                       ]
@@ -4668,7 +4668,7 @@ ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30	{
                     {
                       "access_type": "scan",
                       "rows": 500,
-                      "cost": 4.4414,
+                      "cost": 104.44,
                       "chosen": true
                     }
                   ]
@@ -4916,7 +4916,7 @@ SELECT * FROM v1	{
                           {
                             "access_type": "scan",
                             "rows": 500,
-                            "cost": 4.4414,
+                            "cost": 104.44,
                             "chosen": true
                           }
                         ]
@@ -5000,7 +5000,7 @@ SELECT * FROM v1	{
                     {
                       "access_type": "scan",
                       "rows": 30,
-                      "cost": 11.5,
+                      "cost": 17.5,
                       "chosen": true
                     }
                   ]
@@ -5201,7 +5201,7 @@ SELECT * FROM v1 ORDER BY f2, f0 LIMIT 3
                           {
                             "access_type": "scan",
                             "rows": 500,
-                            "cost": 4.4414,
+                            "cost": 104.44,
                             "chosen": true
                           }
                         ]
@@ -5285,7 +5285,7 @@ SELECT * FROM v1 ORDER BY f2, f0 LIMIT 3
                     {
                       "access_type": "scan",
                       "rows": 100,
-                      "cost": 15,
+                      "cost": 35,
                       "chosen": true
                     }
                   ]
@@ -5552,7 +5552,7 @@ LIMIT 30	{
                           {
                             "access_type": "scan",
                             "rows": 500,
-                            "cost": 4.4414,
+                            "cost": 104.44,
                             "chosen": true
                           }
                         ]
@@ -5640,7 +5640,7 @@ LIMIT 30	{
                           {
                             "access_type": "scan",
                             "rows": 500,
-                            "cost": 4.4414,
+                            "cost": 104.44,
                             "chosen": true
                           }
                         ]
@@ -5807,7 +5807,7 @@ LIMIT 30	{
                     {
                       "access_type": "scan",
                       "rows": 100,
-                      "cost": 15,
+                      "cost": 35,
                       "chosen": true
                     }
                   ]
@@ -5840,7 +5840,7 @@ LIMIT 30	{
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 75,
-                          "cost": 22.403,
+                          "cost": 1522.4,
                           "chosen": false
                         }
                       ]
@@ -5872,7 +5872,7 @@ LIMIT 30	{
                     {
                       "access_type": "scan",
                       "rows": 100,
-                      "cost": 15,
+                      "cost": 35,
                       "chosen": true
                     }
                   ]
@@ -5905,7 +5905,7 @@ LIMIT 30	{
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 75,
-                          "cost": 22.403,
+                          "cost": 1522.4,
                           "chosen": false
                         }
                       ]
@@ -6182,7 +6182,7 @@ GROUP BY 1 ORDER BY 2,1 LIMIT 5	{
                     {
                       "access_type": "scan",
                       "rows": 500,
-                      "cost": 4.4414,
+                      "cost": 104.44,
                       "chosen": true
                     }
                   ]
@@ -6453,7 +6453,7 @@ SELECT * FROM t1 WHERE f1>10 ORDER BY f2
                     {
                       "access_type": "scan",
                       "rows": 500,
-                      "cost": 4.4414,
+                      "cost": 104.44,
                       "chosen": true
                     }
                   ]
@@ -6633,7 +6633,7 @@ SELECT * FROM t1 WHERE f1>10 ORDER BY f2
                     {
                       "access_type": "scan",
                       "rows": 500,
-                      "cost": 4.4414,
+                      "cost": 104.44,
                       "chosen": true
                     }
                   ]
@@ -6814,7 +6814,7 @@ ORDER BY f2, f0 LIMIT 15 OFFSET 15	{
                     {
                       "access_type": "scan",
                       "rows": 500,
-                      "cost": 4.4414,
+                      "cost": 104.44,
                       "chosen": true
                     }
                   ]
@@ -7010,7 +7010,7 @@ SELECT * FROM v1 ORDER BY f2, f0 LIMIT 3
                           {
                             "access_type": "scan",
                             "rows": 500,
-                            "cost": 4.4414,
+                            "cost": 104.44,
                             "chosen": true
                           }
                         ]
@@ -7094,7 +7094,7 @@ SELECT * FROM v1 ORDER BY f2, f0 LIMIT 3
                     {
                       "access_type": "scan",
                       "rows": 100,
-                      "cost": 15,
+                      "cost": 35,
                       "chosen": true
                     }
                   ]
@@ -7335,7 +7335,7 @@ ORDER BY d1.f2 DESC LIMIT 30	{
                           {
                             "access_type": "scan",
                             "rows": 500,
-                            "cost": 4.4414,
+                            "cost": 104.44,
                             "chosen": true
                           }
                         ]
@@ -7455,7 +7455,7 @@ ORDER BY d1.f2 DESC LIMIT 30	{
                     {
                       "access_type": "scan",
                       "rows": 500,
-                      "cost": 4.4414,
+                      "cost": 104.44,
                       "chosen": true
                     }
                   ]
@@ -7488,7 +7488,7 @@ ORDER BY d1.f2 DESC LIMIT 30	{
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 23,
-                          "cost": 13.119,
+                          "cost": 2313.1,
                           "chosen": false
                         }
                       ]
@@ -7736,7 +7736,7 @@ SELECT * FROM t1 WHERE f1 = (SELECT f1 F
                     {
                       "access_type": "scan",
                       "rows": 500,
-                      "cost": 4.4414,
+                      "cost": 104.44,
                       "chosen": true
                     }
                   ]
@@ -7816,7 +7816,7 @@ SELECT * FROM t1 WHERE f1 = (SELECT f1 F
                                 {
                                   "access_type": "scan",
                                   "rows": 500,
-                                  "cost": 4.4414,
+                                  "cost": 104.44,
                                   "chosen": true
                                 }
                               ]
@@ -11486,7 +11486,7 @@ SELECT * FROM t1 WHERE f1 = (SELECT f1 F
                     {
                       "access_type": "scan",
                       "rows": 500,
-                      "cost": 4.4414,
+                      "cost": 104.44,
                       "chosen": true
                     }
                   ]
@@ -11566,7 +11566,7 @@ SELECT * FROM t1 WHERE f1 = (SELECT f1 F
                                 {
                                   "access_type": "scan",
                                   "rows": 500,
-                                  "cost": 4.4414,
+                                  "cost": 104.44,
                                   "chosen": true
                                 }
                               ]
@@ -11824,7 +11824,7 @@ SELECT * FROM t1 ORDER BY f2 LIMIT 100	{
                     {
                       "access_type": "scan",
                       "rows": 438500,
-                      "cost": 2143.1,
+                      "cost": 89843,
                       "chosen": true
                     }
                   ]

=== modified file 'mysql-test/suite/opt_trace/r/general2_no_prot.result'
--- a/mysql-test/suite/opt_trace/r/general2_no_prot.result	2012-05-31 14:28:35 +0000
+++ b/mysql-test/suite/opt_trace/r/general2_no_prot.result	2012-06-05 07:13:40 +0000
@@ -338,6 +338,7 @@ TRACE
                         "rows": 2,
                         "cost": 3.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -362,7 +363,7 @@ TRACE
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0034,
+                      "cost": 2.4034,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -543,7 +544,7 @@ TRACE
                     {
                       "access_type": "scan",
                       "rows": 4,
-                      "cost": 2.0068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -562,7 +563,7 @@ TRACE
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 4,
-                          "cost": 2.0071,
+                          "cost": 5.2071,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -582,7 +583,7 @@ TRACE
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 4,
-                              "cost": 2.009,
+                              "cost": 14.809,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -841,7 +842,7 @@ TRACE
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0098,
+                      "cost": 2.4098,
                       "chosen": true,
                       "use_tmp_table": true
                     }
@@ -861,7 +862,7 @@ TRACE
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 1,
-                          "cost": 2.005,
+                          "cost": 2.405,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -881,7 +882,7 @@ TRACE
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 2,
-                              "cost": 2.0099,
+                              "cost": 2.8099,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -905,7 +906,7 @@ TRACE
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 2,
-                          "cost": 2.0099,
+                          "cost": 2.8099,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -1057,7 +1058,7 @@ TRACE
                                     {
                                       "access_type": "scan",
                                       "rows": 2,
-                                      "cost": 2.0098,
+                                      "cost": 2.4098,
                                       "chosen": true
                                     }
                                   ] /* considered_access_paths */
@@ -1233,7 +1234,7 @@ TRACE
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0066,
+                            "cost": 2.6066,
                             "chosen": true,
                             "use_tmp_table": true
                           }
@@ -1317,7 +1318,7 @@ TRACE
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 10.15,
+                      "cost": 10.75,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -1724,7 +1725,7 @@ SET @a=(select count(a) from t1 where a>
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0051,
+                            "cost": 2.6051,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -1848,7 +1849,7 @@ set_case_expr (15) 0 (select count(`a`) 
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0051,
+                            "cost": 2.6051,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -2002,7 +2003,7 @@ call p1((select a from t1 limit 1))	{
                           {
                             "access_type": "scan",
                             "rows": 2,
-                            "cost": 2.0034,
+                            "cost": 2.4034,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -2153,7 +2154,7 @@ select concat(concat(_latin1'->',f1),_la
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0098,
+                      "cost": 2.4098,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2424,7 +2425,7 @@ table3.col_varchar_10_utf8_key	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0107,
+                      "cost": 2.4107,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2444,7 +2445,7 @@ table3.col_varchar_10_utf8_key	{
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 1,
-                          "cost": 2.005,
+                          "cost": 2.405,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -2703,7 +2704,7 @@ from t0 where a in
                     {
                       "access_type": "scan",
                       "rows": 10,
-                      "cost": 2.0171,
+                      "cost": 4.0171,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2883,7 +2884,7 @@ from t0 where a in
                           {
                             "access_type": "scan",
                             "rows": 10,
-                            "cost": 2.022,
+                            "cost": 4.022,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -2909,7 +2910,7 @@ from t0 where a in
                                 "access_type": "scan",
                                 "using_join_cache": true,
                                 "rows": 8,
-                                "cost": 2.4227,
+                                "cost": 18.423,
                                 "chosen": false
                               }
                             ] /* considered_access_paths */
@@ -2936,7 +2937,7 @@ from t0 where a in
                                     "access_type": "scan",
                                     "using_join_cache": true,
                                     "rows": 8,
-                                    "cost": 2.4237,
+                                    "cost": 18.424,
                                     "chosen": false
                                   }
                                 ] /* considered_access_paths */
@@ -2965,7 +2966,7 @@ from t0 where a in
                           {
                             "access_type": "scan",
                             "rows": 10,
-                            "cost": 2.022,
+                            "cost": 4.022,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -2991,7 +2992,7 @@ from t0 where a in
                                 "access_type": "scan",
                                 "using_join_cache": true,
                                 "rows": 8,
-                                "cost": 2.4229,
+                                "cost": 18.423,
                                 "chosen": false
                               }
                             ] /* considered_access_paths */
@@ -3018,7 +3019,7 @@ from t0 where a in
                                     "access_type": "scan",
                                     "using_join_cache": true,
                                     "rows": 8,
-                                    "cost": 2.4237,
+                                    "cost": 18.424,
                                     "chosen": false
                                   }
                                 ] /* considered_access_paths */
@@ -3047,7 +3048,7 @@ from t0 where a in
                                     "access_type": "scan",
                                     "using_join_cache": true,
                                     "rows": 8,
-                                    "cost": 2.4237,
+                                    "cost": 18.424,
                                     "chosen": false
                                   }
                                 ] /* considered_access_paths */
@@ -3076,7 +3077,7 @@ from t0 where a in
                                 "access_type": "scan",
                                 "using_join_cache": true,
                                 "rows": 8,
-                                "cost": 2.4229,
+                                "cost": 18.423,
                                 "chosen": false
                               }
                             ] /* considered_access_paths */
@@ -3102,7 +3103,7 @@ from t0 where a in
                           {
                             "access_type": "scan",
                             "rows": 10,
-                            "cost": 2.022,
+                            "cost": 4.022,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -3128,7 +3129,7 @@ from t0 where a in
                                 "access_type": "scan",
                                 "using_join_cache": true,
                                 "rows": 8,
-                                "cost": 2.4229,
+                                "cost": 18.423,
                                 "chosen": false
                               }
                             ] /* considered_access_paths */
@@ -3155,7 +3156,7 @@ from t0 where a in
                                     "access_type": "scan",
                                     "using_join_cache": true,
                                     "rows": 8,
-                                    "cost": 2.4237,
+                                    "cost": 18.424,
                                     "chosen": false
                                   }
                                 ] /* considered_access_paths */
@@ -3184,7 +3185,7 @@ from t0 where a in
                                     "access_type": "scan",
                                     "using_join_cache": true,
                                     "rows": 8,
-                                    "cost": 2.4237,
+                                    "cost": 18.424,
                                     "chosen": false
                                   }
                                 ] /* considered_access_paths */
@@ -3213,7 +3214,7 @@ from t0 where a in
                                 "access_type": "scan",
                                 "using_join_cache": true,
                                 "rows": 8,
-                                "cost": 2.4229,
+                                "cost": 18.423,
                                 "chosen": false
                               }
                             ] /* considered_access_paths */
@@ -3503,7 +3504,7 @@ select 497, tmp.ID, NULL from (select 49
                           },
                           {
                             "access_type": "scan",
-                            "cost": 2,
+                            "cost": 3.6,
                             "rows": 8,
                             "cause": "cost",
                             "chosen": false
@@ -3530,7 +3531,7 @@ select 497, tmp.ID, NULL from (select 49
                               },
                               {
                                 "access_type": "scan",
-                                "cost": 2,
+                                "cost": 3.8,
                                 "rows": 9,
                                 "cause": "cost",
                                 "chosen": false
@@ -3556,7 +3557,7 @@ select 497, tmp.ID, NULL from (select 49
                               },
                               {
                                 "access_type": "scan",
-                                "cost": 2,
+                                "cost": 3.8,
                                 "rows": 9,
                                 "cause": "cost",
                                 "chosen": false
@@ -3585,7 +3586,7 @@ select 497, tmp.ID, NULL from (select 49
                           },
                           {
                             "access_type": "scan",
-                            "cost": 2,
+                            "cost": 3.8,
                             "rows": 9,
                             "cause": "cost",
                             "chosen": false
@@ -3637,7 +3638,7 @@ select 497, tmp.ID, NULL from (select 49
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 10.1,
+                      "cost": 10.5,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -4013,6 +4014,7 @@ select replace(t3._field_140, "\r","^M")
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -4099,6 +4101,7 @@ select replace(t3._field_140, "\r","^M")
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -4195,6 +4198,7 @@ select replace(t3._field_140, "\r","^M")
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -4286,7 +4290,7 @@ select replace(t3._field_140, "\r","^M")
                     },
                     {
                       "access_type": "scan",
-                      "cost": 2,
+                      "cost": 2.4,
                       "rows": 2,
                       "cause": "cost",
                       "chosen": false
@@ -4313,7 +4317,7 @@ select replace(t3._field_140, "\r","^M")
                         },
                         {
                           "access_type": "scan",
-                          "cost": 2,
+                          "cost": 2.6,
                           "rows": 3,
                           "cause": "cost",
                           "chosen": false
@@ -4342,7 +4346,7 @@ select replace(t3._field_140, "\r","^M")
                             },
                             {
                               "access_type": "scan",
-                              "cost": 2,
+                              "cost": 2.6,
                               "rows": 3,
                               "cause": "cost",
                               "chosen": false
@@ -4372,7 +4376,7 @@ select replace(t3._field_140, "\r","^M")
                                 },
                                 {
                                   "access_type": "scan",
-                                  "cost": 2,
+                                  "cost": 2.6,
                                   "rows": 3,
                                   "cause": "cost",
                                   "chosen": false
@@ -4403,7 +4407,7 @@ select replace(t3._field_140, "\r","^M")
                                     },
                                     {
                                       "access_type": "scan",
-                                      "cost": 2,
+                                      "cost": 2.6,
                                       "rows": 3,
                                       "cause": "cost",
                                       "chosen": false
@@ -4435,7 +4439,7 @@ select replace(t3._field_140, "\r","^M")
                                         },
                                         {
                                           "access_type": "scan",
-                                          "cost": 2,
+                                          "cost": 2.4,
                                           "rows": 2,
                                           "cause": "cost",
                                           "chosen": false
@@ -4776,7 +4780,7 @@ GROUP BY field2 ORDER BY alias1.col_int_
                     {
                       "access_type": "scan",
                       "rows": 20,
-                      "cost": 2.0977,
+                      "cost": 6.0977,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -4802,7 +4806,7 @@ GROUP BY field2 ORDER BY alias1.col_int_
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 75,
-                          "cost": 7.4917,
+                          "cost": 307.49,
                           "chosen": false
                         }
                       ] /* considered_access_paths */
@@ -5114,7 +5118,7 @@ select * from t1,mysqltest2.t2	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0034,
+                      "cost": 2.4034,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -5133,7 +5137,7 @@ select * from t1,mysqltest2.t2	{
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 3,
-                          "cost": 2.0053,
+                          "cost": 3.2053,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -5153,7 +5157,7 @@ select * from t1,mysqltest2.t2	{
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */

=== modified file 'mysql-test/suite/opt_trace/r/general2_ps_prot.result'
--- a/mysql-test/suite/opt_trace/r/general2_ps_prot.result	2012-05-31 14:28:35 +0000
+++ b/mysql-test/suite/opt_trace/r/general2_ps_prot.result	2012-06-05 07:13:40 +0000
@@ -366,6 +366,7 @@ TRACE
                         "rows": 2,
                         "cost": 3.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -390,7 +391,7 @@ TRACE
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0034,
+                      "cost": 2.4034,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -571,7 +572,7 @@ TRACE
                     {
                       "access_type": "scan",
                       "rows": 4,
-                      "cost": 2.0068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -590,7 +591,7 @@ TRACE
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 4,
-                          "cost": 2.0071,
+                          "cost": 5.2071,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -610,7 +611,7 @@ TRACE
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 4,
-                              "cost": 2.009,
+                              "cost": 14.809,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -857,7 +858,7 @@ TRACE
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0098,
+                      "cost": 2.4098,
                       "chosen": true,
                       "use_tmp_table": true
                     }
@@ -877,7 +878,7 @@ TRACE
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 1,
-                          "cost": 2.005,
+                          "cost": 2.405,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -897,7 +898,7 @@ TRACE
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 2,
-                              "cost": 2.0099,
+                              "cost": 2.8099,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -921,7 +922,7 @@ TRACE
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 2,
-                          "cost": 2.0099,
+                          "cost": 2.8099,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -1073,7 +1074,7 @@ TRACE
                                     {
                                       "access_type": "scan",
                                       "rows": 2,
-                                      "cost": 2.0098,
+                                      "cost": 2.4098,
                                       "chosen": true
                                     }
                                   ] /* considered_access_paths */
@@ -1249,7 +1250,7 @@ TRACE
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0066,
+                            "cost": 2.6066,
                             "chosen": true,
                             "use_tmp_table": true
                           }
@@ -1333,7 +1334,7 @@ TRACE
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 10.15,
+                      "cost": 10.75,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -1740,7 +1741,7 @@ SET @a=(select count(a) from t1 where a>
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0051,
+                            "cost": 2.6051,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -1864,7 +1865,7 @@ set_case_expr (15) 0 (select count(`a`) 
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0051,
+                            "cost": 2.6051,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -2053,7 +2054,7 @@ call p1((select a from t1 limit 1))	{
                           {
                             "access_type": "scan",
                             "rows": 2,
-                            "cost": 2.0034,
+                            "cost": 2.4034,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -2204,7 +2205,7 @@ select concat(concat(_latin1'->',f1),_la
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0098,
+                      "cost": 2.4098,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2475,7 +2476,7 @@ table3.col_varchar_10_utf8_key	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0107,
+                      "cost": 2.4107,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2495,7 +2496,7 @@ table3.col_varchar_10_utf8_key	{
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 1,
-                          "cost": 2.005,
+                          "cost": 2.405,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -2754,7 +2755,7 @@ from t0 where a in
                     {
                       "access_type": "scan",
                       "rows": 10,
-                      "cost": 2.0171,
+                      "cost": 4.0171,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2934,7 +2935,7 @@ from t0 where a in
                           {
                             "access_type": "scan",
                             "rows": 10,
-                            "cost": 2.022,
+                            "cost": 4.022,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -2960,7 +2961,7 @@ from t0 where a in
                                 "access_type": "scan",
                                 "using_join_cache": true,
                                 "rows": 8,
-                                "cost": 2.4227,
+                                "cost": 18.423,
                                 "chosen": false
                               }
                             ] /* considered_access_paths */
@@ -2987,7 +2988,7 @@ from t0 where a in
                                     "access_type": "scan",
                                     "using_join_cache": true,
                                     "rows": 8,
-                                    "cost": 2.4237,
+                                    "cost": 18.424,
                                     "chosen": false
                                   }
                                 ] /* considered_access_paths */
@@ -3016,7 +3017,7 @@ from t0 where a in
                           {
                             "access_type": "scan",
                             "rows": 10,
-                            "cost": 2.022,
+                            "cost": 4.022,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -3042,7 +3043,7 @@ from t0 where a in
                                 "access_type": "scan",
                                 "using_join_cache": true,
                                 "rows": 8,
-                                "cost": 2.4229,
+                                "cost": 18.423,
                                 "chosen": false
                               }
                             ] /* considered_access_paths */
@@ -3069,7 +3070,7 @@ from t0 where a in
                                     "access_type": "scan",
                                     "using_join_cache": true,
                                     "rows": 8,
-                                    "cost": 2.4237,
+                                    "cost": 18.424,
                                     "chosen": false
                                   }
                                 ] /* considered_access_paths */
@@ -3098,7 +3099,7 @@ from t0 where a in
                                     "access_type": "scan",
                                     "using_join_cache": true,
                                     "rows": 8,
-                                    "cost": 2.4237,
+                                    "cost": 18.424,
                                     "chosen": false
                                   }
                                 ] /* considered_access_paths */
@@ -3127,7 +3128,7 @@ from t0 where a in
                                 "access_type": "scan",
                                 "using_join_cache": true,
                                 "rows": 8,
-                                "cost": 2.4229,
+                                "cost": 18.423,
                                 "chosen": false
                               }
                             ] /* considered_access_paths */
@@ -3153,7 +3154,7 @@ from t0 where a in
                           {
                             "access_type": "scan",
                             "rows": 10,
-                            "cost": 2.022,
+                            "cost": 4.022,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -3179,7 +3180,7 @@ from t0 where a in
                                 "access_type": "scan",
                                 "using_join_cache": true,
                                 "rows": 8,
-                                "cost": 2.4229,
+                                "cost": 18.423,
                                 "chosen": false
                               }
                             ] /* considered_access_paths */
@@ -3206,7 +3207,7 @@ from t0 where a in
                                     "access_type": "scan",
                                     "using_join_cache": true,
                                     "rows": 8,
-                                    "cost": 2.4237,
+                                    "cost": 18.424,
                                     "chosen": false
                                   }
                                 ] /* considered_access_paths */
@@ -3235,7 +3236,7 @@ from t0 where a in
                                     "access_type": "scan",
                                     "using_join_cache": true,
                                     "rows": 8,
-                                    "cost": 2.4237,
+                                    "cost": 18.424,
                                     "chosen": false
                                   }
                                 ] /* considered_access_paths */
@@ -3264,7 +3265,7 @@ from t0 where a in
                                 "access_type": "scan",
                                 "using_join_cache": true,
                                 "rows": 8,
-                                "cost": 2.4229,
+                                "cost": 18.423,
                                 "chosen": false
                               }
                             ] /* considered_access_paths */
@@ -3554,7 +3555,7 @@ select 497, tmp.ID, NULL from (select 49
                           },
                           {
                             "access_type": "scan",
-                            "cost": 2,
+                            "cost": 3.6,
                             "rows": 8,
                             "cause": "cost",
                             "chosen": false
@@ -3581,7 +3582,7 @@ select 497, tmp.ID, NULL from (select 49
                               },
                               {
                                 "access_type": "scan",
-                                "cost": 2,
+                                "cost": 3.8,
                                 "rows": 9,
                                 "cause": "cost",
                                 "chosen": false
@@ -3607,7 +3608,7 @@ select 497, tmp.ID, NULL from (select 49
                               },
                               {
                                 "access_type": "scan",
-                                "cost": 2,
+                                "cost": 3.8,
                                 "rows": 9,
                                 "cause": "cost",
                                 "chosen": false
@@ -3636,7 +3637,7 @@ select 497, tmp.ID, NULL from (select 49
                           },
                           {
                             "access_type": "scan",
-                            "cost": 2,
+                            "cost": 3.8,
                             "rows": 9,
                             "cause": "cost",
                             "chosen": false
@@ -3688,7 +3689,7 @@ select 497, tmp.ID, NULL from (select 49
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 10.1,
+                      "cost": 10.5,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -4064,6 +4065,7 @@ select replace(t3._field_140, "\r","^M")
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -4150,6 +4152,7 @@ select replace(t3._field_140, "\r","^M")
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -4246,6 +4249,7 @@ select replace(t3._field_140, "\r","^M")
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -4337,7 +4341,7 @@ select replace(t3._field_140, "\r","^M")
                     },
                     {
                       "access_type": "scan",
-                      "cost": 2,
+                      "cost": 2.4,
                       "rows": 2,
                       "cause": "cost",
                       "chosen": false
@@ -4364,7 +4368,7 @@ select replace(t3._field_140, "\r","^M")
                         },
                         {
                           "access_type": "scan",
-                          "cost": 2,
+                          "cost": 2.6,
                           "rows": 3,
                           "cause": "cost",
                           "chosen": false
@@ -4393,7 +4397,7 @@ select replace(t3._field_140, "\r","^M")
                             },
                             {
                               "access_type": "scan",
-                              "cost": 2,
+                              "cost": 2.6,
                               "rows": 3,
                               "cause": "cost",
                               "chosen": false
@@ -4423,7 +4427,7 @@ select replace(t3._field_140, "\r","^M")
                                 },
                                 {
                                   "access_type": "scan",
-                                  "cost": 2,
+                                  "cost": 2.6,
                                   "rows": 3,
                                   "cause": "cost",
                                   "chosen": false
@@ -4454,7 +4458,7 @@ select replace(t3._field_140, "\r","^M")
                                     },
                                     {
                                       "access_type": "scan",
-                                      "cost": 2,
+                                      "cost": 2.6,
                                       "rows": 3,
                                       "cause": "cost",
                                       "chosen": false
@@ -4486,7 +4490,7 @@ select replace(t3._field_140, "\r","^M")
                                         },
                                         {
                                           "access_type": "scan",
-                                          "cost": 2,
+                                          "cost": 2.4,
                                           "rows": 2,
                                           "cause": "cost",
                                           "chosen": false
@@ -4827,7 +4831,7 @@ GROUP BY field2 ORDER BY alias1.col_int_
                     {
                       "access_type": "scan",
                       "rows": 20,
-                      "cost": 2.0977,
+                      "cost": 6.0977,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -4853,7 +4857,7 @@ GROUP BY field2 ORDER BY alias1.col_int_
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 75,
-                          "cost": 7.4917,
+                          "cost": 307.49,
                           "chosen": false
                         }
                       ] /* considered_access_paths */
@@ -5165,7 +5169,7 @@ select * from t1,mysqltest2.t2	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0034,
+                      "cost": 2.4034,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -5184,7 +5188,7 @@ select * from t1,mysqltest2.t2	{
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 3,
-                          "cost": 2.0053,
+                          "cost": 3.2053,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -5204,7 +5208,7 @@ select * from t1,mysqltest2.t2	{
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */

=== modified file 'mysql-test/suite/opt_trace/r/general_no_prot_all.result'
--- a/mysql-test/suite/opt_trace/r/general_no_prot_all.result	2012-05-31 14:28:35 +0000
+++ b/mysql-test/suite/opt_trace/r/general_no_prot_all.result	2012-06-05 07:13:40 +0000
@@ -1527,6 +1527,7 @@ explain SELECT c FROM t5 where c+1 in (s
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": true,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -1560,7 +1561,7 @@ explain SELECT c FROM t5 where c+1 in (s
                           },
                           {
                             "access_type": "scan",
-                            "cost": 2,
+                            "cost": 2.4,
                             "rows": 2,
                             "cause": "cost",
                             "chosen": false
@@ -1594,7 +1595,7 @@ explain SELECT c FROM t5 where c+1 in (s
                     },
                     {
                       "access_type": "scan",
-                      "cost": 2,
+                      "cost": 2.4,
                       "rows": 2,
                       "cause": "cost",
                       "chosen": false
@@ -1900,6 +1901,7 @@ explain SELECT c FROM t5 where c+1 in (s
                               "rows": 1,
                               "cost": 2.21,
                               "rowid_ordered": true,
+                              "using_mrr": false,
                               "chosen": false,
                               "cause": "cost"
                             }
@@ -1930,7 +1932,7 @@ explain SELECT c FROM t5 where c+1 in (s
                           },
                           {
                             "access_type": "scan",
-                            "cost": 2,
+                            "cost": 2.4,
                             "rows": 2,
                             "cause": "cost",
                             "chosen": false
@@ -2087,7 +2089,7 @@ explain extended select * from t1 where 
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0054,
+                      "cost": 2.4054,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2163,7 +2165,7 @@ explain extended select * from t1 where 
                           {
                             "access_type": "scan",
                             "rows": 2,
-                            "cost": 2.0054,
+                            "cost": 2.4054,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -2315,7 +2317,7 @@ explain extended select * from t1 where 
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0054,
+                      "cost": 2.4054,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2391,7 +2393,7 @@ explain extended select * from t1 where 
                           {
                             "access_type": "scan",
                             "rows": 2,
-                            "cost": 2.0054,
+                            "cost": 2.4054,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -2553,7 +2555,7 @@ explain extended select * from t1 where 
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0054,
+                      "cost": 2.4054,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2653,7 +2655,7 @@ explain extended select * from t1 where 
                           {
                             "access_type": "scan",
                             "rows": 2,
-                            "cost": 2.0054,
+                            "cost": 2.4054,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -2815,7 +2817,7 @@ explain extended select * from t1 where 
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0054,
+                      "cost": 2.4054,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2915,7 +2917,7 @@ explain extended select * from t1 where 
                           {
                             "access_type": "scan",
                             "rows": 2,
-                            "cost": 2.0054,
+                            "cost": 2.4054,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -3038,7 +3040,7 @@ explain select * from t1,t2	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0034,
+                      "cost": 2.4034,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -3057,7 +3059,7 @@ explain select * from t1,t2	{
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 3,
-                          "cost": 2.0053,
+                          "cost": 3.2053,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -3077,7 +3079,7 @@ explain select * from t1,t2	{
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -3096,7 +3098,7 @@ explain select * from t1,t2	{
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 2,
-                          "cost": 2.0036,
+                          "cost": 3.2036,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -3413,7 +3415,7 @@ where a1 in (select b1 from t2_16 where 
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0293,
+                      "cost": 2.6293,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -3513,7 +3515,7 @@ where a1 in (select b1 from t2_16 where 
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0293,
+                            "cost": 2.6293,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -3724,7 +3726,7 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0051,
+                            "cost": 2.6051,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -3749,7 +3751,7 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -3770,7 +3772,7 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 3,
-                          "cost": 2.0054,
+                          "cost": 3.8054,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -3792,7 +3794,7 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 3,
-                              "cost": 2.0066,
+                              "cost": 7.4066,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -3812,7 +3814,7 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2
                                         "access_type": "scan",
                                         "using_join_cache": true,
                                         "rows": 3,
-                                        "cost": 2.0066,
+                                        "cost": 7.4066,
                                         "chosen": true
                                       }
                                     ] /* considered_access_paths */
@@ -3854,7 +3856,7 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 3,
-                          "cost": 2.0054,
+                          "cost": 3.8054,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -3880,7 +3882,7 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -3900,7 +3902,7 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -4085,7 +4087,7 @@ SELECT * FROM t1 WHERE c1=5 UNION SELECT
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -4181,7 +4183,7 @@ SELECT * FROM t1 WHERE c1=5 UNION SELECT
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -4277,7 +4279,7 @@ SELECT * FROM t1 WHERE c1=5 UNION SELECT
                     {
                       "access_type": "scan",
                       "rows": 1,
-                      "cost": 10.05,
+                      "cost": 10.25,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -4475,7 +4477,7 @@ concat(c1,'y') IN
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -4589,7 +4591,7 @@ concat(c1,'y') IN
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0051,
+                            "cost": 2.6051,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -4668,7 +4670,7 @@ concat(c1,'y') IN
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0051,
+                            "cost": 2.6051,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -5017,7 +5019,7 @@ trace
                     {
                       "access_type": "scan",
                       "rows": 1,
-                      "cost": 2.0017,
+                      "cost": 2.2017,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -5039,7 +5041,7 @@ trace
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 1,
-                          "cost": 2.0018,
+                          "cost": 2.2018,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -5067,7 +5069,7 @@ trace
                             },
                             {
                               "access_type": "scan",
-                              "cost": 2,
+                              "cost": 2.4,
                               "rows": 2,
                               "cause": "cost",
                               "chosen": false
@@ -5106,7 +5108,7 @@ trace
                         },
                         {
                           "access_type": "scan",
-                          "cost": 2,
+                          "cost": 2.4,
                           "rows": 2,
                           "cause": "cost",
                           "chosen": false
@@ -5131,7 +5133,7 @@ trace
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 1,
-                              "cost": 2.0018,
+                              "cost": 2.2018,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -5163,7 +5165,7 @@ trace
                     {
                       "access_type": "scan",
                       "rows": 1,
-                      "cost": 2.0017,
+                      "cost": 2.2017,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -5190,7 +5192,7 @@ trace
                     },
                     {
                       "access_type": "scan",
-                      "cost": 2,
+                      "cost": 2.4,
                       "rows": 2,
                       "cause": "cost",
                       "chosen": false
@@ -5214,7 +5216,7 @@ trace
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 1,
-                          "cost": 2.0018,
+                          "cost": 2.2018,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -5237,7 +5239,7 @@ trace
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 1,
-                              "cost": 2.0018,
+                              "cost": 2.2018,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -5256,7 +5258,7 @@ trace
                                       {
                                         "access_type": "scan",
                                         "rows": 1,
-                                        "cost": 2.0017,
+                                        "cost": 2.2017,
                                         "chosen": true
                                       }
                                     ] /* considered_access_paths */
@@ -5269,7 +5271,7 @@ trace
                                       {
                                         "access_type": "scan",
                                         "rows": 1,
-                                        "cost": 2.0017,
+                                        "cost": 2.2017,
                                         "chosen": true
                                       }
                                     ] /* considered_access_paths */
@@ -5305,7 +5307,7 @@ trace
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 1,
-                          "cost": 2.0018,
+                          "cost": 2.2018,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -5329,7 +5331,7 @@ trace
                           {
                             "access_type": "scan",
                             "rows": 1,
-                            "cost": 2.0017,
+                            "cost": 2.2017,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -5342,7 +5344,7 @@ trace
                           {
                             "access_type": "scan",
                             "rows": 1,
-                            "cost": 2.0017,
+                            "cost": 2.2017,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -5500,7 +5502,7 @@ trace
                     {
                       "access_type": "scan",
                       "rows": 1,
-                      "cost": 2.0017,
+                      "cost": 2.2017,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -5522,7 +5524,7 @@ trace
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 1,
-                          "cost": 2.0018,
+                          "cost": 2.2018,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -5550,7 +5552,7 @@ trace
                             },
                             {
                               "access_type": "scan",
-                              "cost": 2,
+                              "cost": 2.4,
                               "rows": 2,
                               "cause": "cost",
                               "chosen": false
@@ -5589,7 +5591,7 @@ trace
                         },
                         {
                           "access_type": "scan",
-                          "cost": 2,
+                          "cost": 2.4,
                           "rows": 2,
                           "cause": "cost",
                           "chosen": false
@@ -5614,7 +5616,7 @@ trace
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 1,
-                              "cost": 2.0018,
+                              "cost": 2.2018,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -5646,7 +5648,7 @@ trace
                     {
                       "access_type": "scan",
                       "rows": 1,
-                      "cost": 2.0017,
+                      "cost": 2.2017,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -5673,7 +5675,7 @@ trace
                     },
                     {
                       "access_type": "scan",
-                      "cost": 2,
+                      "cost": 2.4,
                       "rows": 2,
                       "cause": "cost",
                       "chosen": false
@@ -5697,7 +5699,7 @@ trace
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 1,
-                          "cost": 2.0018,
+                          "cost": 2.2018,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -5720,7 +5722,7 @@ trace
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 1,
-                              "cost": 2.0018,
+                              "cost": 2.2018,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -5739,7 +5741,7 @@ trace
                                       {
                                         "access_type": "scan",
                                         "rows": 1,
-                                        "cost": 2.0017,
+                                        "cost": 2.2017,
                                         "chosen": true
                                       }
                                     ] /* considered_access_paths */
@@ -5752,7 +5754,7 @@ trace
                                       {
                                         "access_type": "scan",
                                         "rows": 1,
-                                        "cost": 2.0017,
+                                        "cost": 2.2017,
                                         "chosen": true
                                       }
                                     ] /* considered_access_paths */
@@ -5788,7 +5790,7 @@ trace
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 1,
-                          "cost": 2.0018,
+                          "cost": 2.2018,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -5812,7 +5814,7 @@ trace
                           {
                             "access_type": "scan",
                             "rows": 1,
-                            "cost": 2.0017,
+                            "cost": 2.2017,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -5825,7 +5827,7 @@ trace
                           {
                             "access_type": "scan",
                             "rows": 1,
-                            "cost": 2.0017,
+                            "cost": 2.2017,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -5958,7 +5960,7 @@ select * from t1 left join t2 on t2.a=50
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0034,
+                      "cost": 2.4034,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -5977,7 +5979,7 @@ select * from t1 left join t2 on t2.a=50
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 2,
-                          "cost": 2.0036,
+                          "cost": 2.8036,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -6160,7 +6162,7 @@ select * from t1 where (t1.a,t1.b) not i
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0044,
+                      "cost": 2.4044,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -6280,7 +6282,7 @@ select * from t1 where (t1.a,t1.b) not i
                                 {
                                   "access_type": "scan",
                                   "rows": 2,
-                                  "cost": 2.0044,
+                                  "cost": 2.4044,
                                   "chosen": true
                                 }
                               ] /* considered_access_paths */
@@ -6454,7 +6456,7 @@ trace
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0044,
+                      "cost": 2.4044,
                       "chosen": true,
                       "use_tmp_table": true
                     }
@@ -6474,7 +6476,7 @@ trace
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 2,
-                          "cost": 2.0045,
+                          "cost": 2.8045,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -6496,7 +6498,7 @@ trace
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0044,
+                      "cost": 2.4044,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -6707,6 +6709,7 @@ update t6 set d=5 where d is NULL	{
               "rows": 1,
               "cost": 2.21,
               "rowid_ordered": true,
+              "using_mrr": false,
               "chosen": true
             }
           ] /* range_scan_alternatives */,
@@ -6771,6 +6774,7 @@ delete from t6 where d=5	{
               "rows": 1,
               "cost": 2.21,
               "rowid_ordered": true,
+              "using_mrr": false,
               "chosen": true
             }
           ] /* range_scan_alternatives */
@@ -6894,6 +6898,7 @@ insert into t6 select * from t6 where d>
                         "rows": 2,
                         "cost": 3.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -6918,7 +6923,7 @@ insert into t6 select * from t6 where d>
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.2051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -7078,6 +7083,7 @@ update t5, t6 set t6.d=t6.d+t5.c+4-t5.c-
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       }
                     ] /* range_scan_alternatives */,
@@ -7115,7 +7121,7 @@ update t5, t6 set t6.d=t6.d+t5.c+4-t5.c-
                     {
                       "access_type": "range",
                       "rows": 1,
-                      "cost": 2.21,
+                      "cost": 2.41,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -7280,6 +7286,7 @@ delete t6 from t5, t6 where d>7000	{
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -7305,7 +7312,7 @@ delete t6 from t5, t6 where d>7000	{
                     {
                       "access_type": "scan",
                       "rows": 1,
-                      "cost": 2.6068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -7686,7 +7693,7 @@ select * from t6 where d in (select f1()
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0212,
+                            "cost": 2.6212,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -7711,7 +7718,7 @@ select * from t6 where d in (select f1()
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0212,
+                      "cost": 2.6212,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -7732,7 +7739,7 @@ select * from t6 where d in (select f1()
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 4,
-                          "cost": 2.0076,
+                          "cost": 4.4076,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -7761,7 +7768,7 @@ select * from t6 where d in (select f1()
                     {
                       "access_type": "scan",
                       "rows": 4,
-                      "cost": 2.0068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -7899,7 +7906,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8017,7 +8024,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8135,7 +8142,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8253,7 +8260,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8472,7 +8479,7 @@ select d into res from t6 where d in (se
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0212,
+                            "cost": 2.6212,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -8497,7 +8504,7 @@ select d into res from t6 where d in (se
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0212,
+                      "cost": 2.6212,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8518,7 +8525,7 @@ select d into res from t6 where d in (se
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 4,
-                          "cost": 2.0076,
+                          "cost": 4.4076,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -8547,7 +8554,7 @@ select d into res from t6 where d in (se
                     {
                       "access_type": "scan",
                       "rows": 4,
-                      "cost": 2.0068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8685,7 +8692,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8803,7 +8810,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8921,7 +8928,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9039,7 +9046,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9296,6 +9303,7 @@ insert into t2 select d,100,200 from t6 
                         "rows": 4,
                         "cost": 1.8798,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -9320,7 +9328,7 @@ insert into t2 select d,100,200 from t6 
                     {
                       "access_type": "scan",
                       "rows": 4,
-                      "cost": 2.0068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9438,7 +9446,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9560,7 +9568,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9682,7 +9690,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9804,7 +9812,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9946,7 +9954,7 @@ select @trace;
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -10151,7 +10159,7 @@ select d into res from t6 where d in (se
                           {
                             "access_type": "scan",
                             "rows": 7,
-                            "cost": 2.0496,
+                            "cost": 3.4496,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -10176,7 +10184,7 @@ select d into res from t6 where d in (se
                     {
                       "access_type": "scan",
                       "rows": 4,
-                      "cost": 2.0068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -10197,7 +10205,7 @@ select d into res from t6 where d in (se
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 7,
-                          "cost": 2.0499,
+                          "cost": 7.6499,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -10217,7 +10225,7 @@ select d into res from t6 where d in (se
                                     "access_type": "scan",
                                     "using_join_cache": true,
                                     "rows": 7,
-                                    "cost": 2.0499,
+                                    "cost": 7.6499,
                                     "chosen": true
                                   }
                                 ] /* considered_access_paths */
@@ -10257,7 +10265,7 @@ select d into res from t6 where d in (se
                     {
                       "access_type": "scan",
                       "rows": 7,
-                      "cost": 2.0496,
+                      "cost": 3.4496,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -10400,7 +10408,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -10518,7 +10526,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -10636,7 +10644,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -10754,7 +10762,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -10906,7 +10914,7 @@ explain select * from v1 where id="b"	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -11095,7 +11103,7 @@ explain select * from v1 where id="b"	{
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0154,
+                            "cost": 2.6154,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -11195,7 +11203,7 @@ explain select * from v1 where id="b"	{
                     },
                     {
                       "access_type": "scan",
-                      "cost": 10,
+                      "cost": 10.4,
                       "rows": 2,
                       "cause": "cost",
                       "chosen": false
@@ -11351,7 +11359,7 @@ VARIABLE_NAME="optimizer_trace"	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 10.1,
+                      "cost": 10.5,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -11510,7 +11518,7 @@ select TRACE into dumpfile 'MYSQLTEST_VA
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 10.1,
+                      "cost": 10.5,
                       "chosen": true
                     }
                   ]

=== modified file 'mysql-test/suite/opt_trace/r/general_no_prot_none.result'
--- a/mysql-test/suite/opt_trace/r/general_no_prot_none.result	2012-05-23 15:13:27 +0000
+++ b/mysql-test/suite/opt_trace/r/general_no_prot_none.result	2012-06-05 07:13:40 +0000
@@ -1543,6 +1543,7 @@ explain SELECT c FROM t5 where c+1 in (s
                               "rows": 1,
                               "cost": 2.21,
                               "rowid_ordered": true,
+                              "using_mrr": false,
                               "chosen": false,
                               "cause": "cost"
                             }
@@ -1573,7 +1574,7 @@ explain SELECT c FROM t5 where c+1 in (s
                           },
                           {
                             "access_type": "scan",
-                            "cost": 2,
+                            "cost": 2.4,
                             "rows": 2,
                             "cause": "cost",
                             "chosen": false
@@ -1824,6 +1825,7 @@ explain SELECT c FROM t5 where c+1 in (s
                               "rows": 1,
                               "cost": 2.21,
                               "rowid_ordered": true,
+                              "using_mrr": false,
                               "chosen": false,
                               "cause": "cost"
                             }
@@ -1854,7 +1856,7 @@ explain SELECT c FROM t5 where c+1 in (s
                           },
                           {
                             "access_type": "scan",
-                            "cost": 2,
+                            "cost": 2.4,
                             "rows": 2,
                             "cause": "cost",
                             "chosen": false
@@ -2011,7 +2013,7 @@ explain extended select * from t1 where 
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0054,
+                      "cost": 2.4054,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2087,7 +2089,7 @@ explain extended select * from t1 where 
                           {
                             "access_type": "scan",
                             "rows": 2,
-                            "cost": 2.0054,
+                            "cost": 2.4054,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -2239,7 +2241,7 @@ explain extended select * from t1 where 
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0054,
+                      "cost": 2.4054,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2315,7 +2317,7 @@ explain extended select * from t1 where 
                           {
                             "access_type": "scan",
                             "rows": 2,
-                            "cost": 2.0054,
+                            "cost": 2.4054,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -2477,7 +2479,7 @@ explain extended select * from t1 where 
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0054,
+                      "cost": 2.4054,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2577,7 +2579,7 @@ explain extended select * from t1 where 
                           {
                             "access_type": "scan",
                             "rows": 2,
-                            "cost": 2.0054,
+                            "cost": 2.4054,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -2739,7 +2741,7 @@ explain extended select * from t1 where 
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0054,
+                      "cost": 2.4054,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2839,7 +2841,7 @@ explain extended select * from t1 where 
                           {
                             "access_type": "scan",
                             "rows": 2,
-                            "cost": 2.0054,
+                            "cost": 2.4054,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -2962,7 +2964,7 @@ explain select * from t1,t2	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0034,
+                      "cost": 2.4034,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2981,7 +2983,7 @@ explain select * from t1,t2	{
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 3,
-                          "cost": 2.0053,
+                          "cost": 3.2053,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -3001,7 +3003,7 @@ explain select * from t1,t2	{
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -3020,7 +3022,7 @@ explain select * from t1,t2	{
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 2,
-                          "cost": 2.0036,
+                          "cost": 3.2036,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -3328,7 +3330,7 @@ where a1 in (select b1 from t2_16 where 
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0293,
+                      "cost": 2.6293,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -3428,7 +3430,7 @@ where a1 in (select b1 from t2_16 where 
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0293,
+                            "cost": 2.6293,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -3623,7 +3625,7 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -3642,7 +3644,7 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 3,
-                          "cost": 2.0054,
+                          "cost": 3.8054,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -3662,7 +3664,7 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -3774,7 +3776,7 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2
                                 {
                                   "access_type": "scan",
                                   "rows": 3,
-                                  "cost": 2.0051,
+                                  "cost": 2.6051,
                                   "chosen": true
                                 }
                               ] /* considered_access_paths */
@@ -3952,7 +3954,7 @@ SELECT * FROM t1 WHERE c1=5 UNION SELECT
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -4048,7 +4050,7 @@ SELECT * FROM t1 WHERE c1=5 UNION SELECT
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -4144,7 +4146,7 @@ SELECT * FROM t1 WHERE c1=5 UNION SELECT
                     {
                       "access_type": "scan",
                       "rows": 1,
-                      "cost": 10.05,
+                      "cost": 10.25,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -4342,7 +4344,7 @@ concat(c1,'y') IN
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -4442,7 +4444,7 @@ concat(c1,'y') IN
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0051,
+                            "cost": 2.6051,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -4545,7 +4547,7 @@ concat(c1,'y') IN
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0051,
+                            "cost": 2.6051,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -5045,7 +5047,7 @@ select * from t1 left join t2 on t2.a=50
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0034,
+                      "cost": 2.4034,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -5064,7 +5066,7 @@ select * from t1 left join t2 on t2.a=50
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 2,
-                          "cost": 2.0036,
+                          "cost": 2.8036,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -5236,7 +5238,7 @@ select * from t1 where (t1.a,t1.b) not i
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0044,
+                      "cost": 2.4044,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -5356,7 +5358,7 @@ select * from t1 where (t1.a,t1.b) not i
                                 {
                                   "access_type": "scan",
                                   "rows": 2,
-                                  "cost": 2.0044,
+                                  "cost": 2.4044,
                                   "chosen": true
                                 }
                               ] /* considered_access_paths */
@@ -5530,7 +5532,7 @@ trace
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0044,
+                      "cost": 2.4044,
                       "chosen": true,
                       "use_tmp_table": true
                     }
@@ -5550,7 +5552,7 @@ trace
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 2,
-                          "cost": 2.0045,
+                          "cost": 2.8045,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -5572,7 +5574,7 @@ trace
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0044,
+                      "cost": 2.4044,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -5783,6 +5785,7 @@ update t6 set d=5 where d is NULL	{
               "rows": 1,
               "cost": 2.21,
               "rowid_ordered": true,
+              "using_mrr": false,
               "chosen": true
             }
           ] /* range_scan_alternatives */,
@@ -5847,6 +5850,7 @@ delete from t6 where d=5	{
               "rows": 1,
               "cost": 2.21,
               "rowid_ordered": true,
+              "using_mrr": false,
               "chosen": true
             }
           ] /* range_scan_alternatives */
@@ -5970,6 +5974,7 @@ insert into t6 select * from t6 where d>
                         "rows": 2,
                         "cost": 3.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -5994,7 +5999,7 @@ insert into t6 select * from t6 where d>
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.2051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -6154,6 +6159,7 @@ update t5, t6 set t6.d=t6.d+t5.c+4-t5.c-
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       }
                     ] /* range_scan_alternatives */,
@@ -6191,7 +6197,7 @@ update t5, t6 set t6.d=t6.d+t5.c+4-t5.c-
                     {
                       "access_type": "range",
                       "rows": 1,
-                      "cost": 2.21,
+                      "cost": 2.41,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -6356,6 +6362,7 @@ delete t6 from t5, t6 where d>7000	{
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -6381,7 +6388,7 @@ delete t6 from t5, t6 where d>7000	{
                     {
                       "access_type": "scan",
                       "rows": 1,
-                      "cost": 2.6068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -6739,7 +6746,7 @@ select * from t6 where d in (select f1()
                     {
                       "access_type": "scan",
                       "rows": 4,
-                      "cost": 2.0068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -6843,7 +6850,7 @@ select * from t6 where d in (select f1()
                                 {
                                   "access_type": "scan",
                                   "rows": 3,
-                                  "cost": 2.0212,
+                                  "cost": 2.6212,
                                   "chosen": true
                                 }
                               ] /* considered_access_paths */
@@ -7005,7 +7012,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -7123,7 +7130,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -7241,7 +7248,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -7359,7 +7366,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -7555,7 +7562,7 @@ select d into res from t6 where d in (se
                     {
                       "access_type": "scan",
                       "rows": 4,
-                      "cost": 2.0068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -7659,7 +7666,7 @@ select d into res from t6 where d in (se
                                 {
                                   "access_type": "scan",
                                   "rows": 3,
-                                  "cost": 2.0212,
+                                  "cost": 2.6212,
                                   "chosen": true
                                 }
                               ] /* considered_access_paths */
@@ -7821,7 +7828,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -7939,7 +7946,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8057,7 +8064,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8175,7 +8182,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8432,6 +8439,7 @@ insert into t2 select d,100,200 from t6 
                         "rows": 4,
                         "cost": 1.8798,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -8456,7 +8464,7 @@ insert into t2 select d,100,200 from t6 
                     {
                       "access_type": "scan",
                       "rows": 4,
-                      "cost": 2.0068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8574,7 +8582,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8696,7 +8704,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8818,7 +8826,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8940,7 +8948,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9082,7 +9090,7 @@ select @trace;
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9264,7 +9272,7 @@ select d into res from t6 where d in (se
                     {
                       "access_type": "scan",
                       "rows": 4,
-                      "cost": 2.0068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9368,7 +9376,7 @@ select d into res from t6 where d in (se
                                 {
                                   "access_type": "scan",
                                   "rows": 7,
-                                  "cost": 2.0496,
+                                  "cost": 3.4496,
                                   "chosen": true
                                 }
                               ] /* considered_access_paths */
@@ -9530,7 +9538,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9648,7 +9656,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9766,7 +9774,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9884,7 +9892,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -10036,7 +10044,7 @@ explain select * from v1 where id="b"	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -10225,7 +10233,7 @@ explain select * from v1 where id="b"	{
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0154,
+                            "cost": 2.6154,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -10325,7 +10333,7 @@ explain select * from v1 where id="b"	{
                     },
                     {
                       "access_type": "scan",
-                      "cost": 10,
+                      "cost": 10.4,
                       "rows": 2,
                       "cause": "cost",
                       "chosen": false
@@ -10481,7 +10489,7 @@ VARIABLE_NAME="optimizer_trace"	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 10.1,
+                      "cost": 10.5,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -10640,7 +10648,7 @@ select TRACE into dumpfile 'MYSQLTEST_VA
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 10.1,
+                      "cost": 10.5,
                       "chosen": true
                     }
                   ]

=== modified file 'mysql-test/suite/opt_trace/r/general_ps_prot_all.result'
--- a/mysql-test/suite/opt_trace/r/general_ps_prot_all.result	2012-05-31 14:28:35 +0000
+++ b/mysql-test/suite/opt_trace/r/general_ps_prot_all.result	2012-06-05 07:13:40 +0000
@@ -1507,6 +1507,7 @@ explain SELECT c FROM t5 where c+1 in (s
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": true,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -1540,7 +1541,7 @@ explain SELECT c FROM t5 where c+1 in (s
                           },
                           {
                             "access_type": "scan",
-                            "cost": 2,
+                            "cost": 2.4,
                             "rows": 2,
                             "cause": "cost",
                             "chosen": false
@@ -1574,7 +1575,7 @@ explain SELECT c FROM t5 where c+1 in (s
                     },
                     {
                       "access_type": "scan",
-                      "cost": 2,
+                      "cost": 2.4,
                       "rows": 2,
                       "cause": "cost",
                       "chosen": false
@@ -1880,6 +1881,7 @@ explain SELECT c FROM t5 where c+1 in (s
                               "rows": 1,
                               "cost": 2.21,
                               "rowid_ordered": true,
+                              "using_mrr": false,
                               "chosen": false,
                               "cause": "cost"
                             }
@@ -1910,7 +1912,7 @@ explain SELECT c FROM t5 where c+1 in (s
                           },
                           {
                             "access_type": "scan",
-                            "cost": 2,
+                            "cost": 2.4,
                             "rows": 2,
                             "cause": "cost",
                             "chosen": false
@@ -2067,7 +2069,7 @@ explain extended select * from t1 where 
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0054,
+                      "cost": 2.4054,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2143,7 +2145,7 @@ explain extended select * from t1 where 
                           {
                             "access_type": "scan",
                             "rows": 2,
-                            "cost": 2.0054,
+                            "cost": 2.4054,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -2295,7 +2297,7 @@ explain extended select * from t1 where 
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0054,
+                      "cost": 2.4054,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2371,7 +2373,7 @@ explain extended select * from t1 where 
                           {
                             "access_type": "scan",
                             "rows": 2,
-                            "cost": 2.0054,
+                            "cost": 2.4054,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -2533,7 +2535,7 @@ explain extended select * from t1 where 
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0054,
+                      "cost": 2.4054,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2633,7 +2635,7 @@ explain extended select * from t1 where 
                           {
                             "access_type": "scan",
                             "rows": 2,
-                            "cost": 2.0054,
+                            "cost": 2.4054,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -2795,7 +2797,7 @@ explain extended select * from t1 where 
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0054,
+                      "cost": 2.4054,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2895,7 +2897,7 @@ explain extended select * from t1 where 
                           {
                             "access_type": "scan",
                             "rows": 2,
-                            "cost": 2.0054,
+                            "cost": 2.4054,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -3018,7 +3020,7 @@ explain select * from t1,t2	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0034,
+                      "cost": 2.4034,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -3037,7 +3039,7 @@ explain select * from t1,t2	{
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 3,
-                          "cost": 2.0053,
+                          "cost": 3.2053,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -3057,7 +3059,7 @@ explain select * from t1,t2	{
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -3076,7 +3078,7 @@ explain select * from t1,t2	{
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 2,
-                          "cost": 2.0036,
+                          "cost": 3.2036,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -3393,7 +3395,7 @@ where a1 in (select b1 from t2_16 where 
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0293,
+                      "cost": 2.6293,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -3493,7 +3495,7 @@ where a1 in (select b1 from t2_16 where 
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0293,
+                            "cost": 2.6293,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -3704,7 +3706,7 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0051,
+                            "cost": 2.6051,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -3729,7 +3731,7 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -3750,7 +3752,7 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 3,
-                          "cost": 2.0054,
+                          "cost": 3.8054,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -3772,7 +3774,7 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 3,
-                              "cost": 2.0066,
+                              "cost": 7.4066,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -3792,7 +3794,7 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2
                                         "access_type": "scan",
                                         "using_join_cache": true,
                                         "rows": 3,
-                                        "cost": 2.0066,
+                                        "cost": 7.4066,
                                         "chosen": true
                                       }
                                     ] /* considered_access_paths */
@@ -3834,7 +3836,7 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 3,
-                          "cost": 2.0054,
+                          "cost": 3.8054,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -3860,7 +3862,7 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -3880,7 +3882,7 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -4065,7 +4067,7 @@ SELECT * FROM t1 WHERE c1=5 UNION SELECT
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -4161,7 +4163,7 @@ SELECT * FROM t1 WHERE c1=5 UNION SELECT
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -4257,7 +4259,7 @@ SELECT * FROM t1 WHERE c1=5 UNION SELECT
                     {
                       "access_type": "scan",
                       "rows": 1,
-                      "cost": 10.05,
+                      "cost": 10.25,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -4455,7 +4457,7 @@ concat(c1,'y') IN
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -4569,7 +4571,7 @@ concat(c1,'y') IN
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0051,
+                            "cost": 2.6051,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -4648,7 +4650,7 @@ concat(c1,'y') IN
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0051,
+                            "cost": 2.6051,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -4997,7 +4999,7 @@ trace
                     {
                       "access_type": "scan",
                       "rows": 1,
-                      "cost": 2.0017,
+                      "cost": 2.2017,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -5019,7 +5021,7 @@ trace
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 1,
-                          "cost": 2.0018,
+                          "cost": 2.2018,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -5047,7 +5049,7 @@ trace
                             },
                             {
                               "access_type": "scan",
-                              "cost": 2,
+                              "cost": 2.4,
                               "rows": 2,
                               "cause": "cost",
                               "chosen": false
@@ -5086,7 +5088,7 @@ trace
                         },
                         {
                           "access_type": "scan",
-                          "cost": 2,
+                          "cost": 2.4,
                           "rows": 2,
                           "cause": "cost",
                           "chosen": false
@@ -5111,7 +5113,7 @@ trace
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 1,
-                              "cost": 2.0018,
+                              "cost": 2.2018,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -5143,7 +5145,7 @@ trace
                     {
                       "access_type": "scan",
                       "rows": 1,
-                      "cost": 2.0017,
+                      "cost": 2.2017,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -5170,7 +5172,7 @@ trace
                     },
                     {
                       "access_type": "scan",
-                      "cost": 2,
+                      "cost": 2.4,
                       "rows": 2,
                       "cause": "cost",
                       "chosen": false
@@ -5194,7 +5196,7 @@ trace
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 1,
-                          "cost": 2.0018,
+                          "cost": 2.2018,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -5217,7 +5219,7 @@ trace
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 1,
-                              "cost": 2.0018,
+                              "cost": 2.2018,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -5236,7 +5238,7 @@ trace
                                       {
                                         "access_type": "scan",
                                         "rows": 1,
-                                        "cost": 2.0017,
+                                        "cost": 2.2017,
                                         "chosen": true
                                       }
                                     ] /* considered_access_paths */
@@ -5249,7 +5251,7 @@ trace
                                       {
                                         "access_type": "scan",
                                         "rows": 1,
-                                        "cost": 2.0017,
+                                        "cost": 2.2017,
                                         "chosen": true
                                       }
                                     ] /* considered_access_paths */
@@ -5285,7 +5287,7 @@ trace
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 1,
-                          "cost": 2.0018,
+                          "cost": 2.2018,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -5309,7 +5311,7 @@ trace
                           {
                             "access_type": "scan",
                             "rows": 1,
-                            "cost": 2.0017,
+                            "cost": 2.2017,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -5322,7 +5324,7 @@ trace
                           {
                             "access_type": "scan",
                             "rows": 1,
-                            "cost": 2.0017,
+                            "cost": 2.2017,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -5480,7 +5482,7 @@ trace
                     {
                       "access_type": "scan",
                       "rows": 1,
-                      "cost": 2.0017,
+                      "cost": 2.2017,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -5502,7 +5504,7 @@ trace
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 1,
-                          "cost": 2.0018,
+                          "cost": 2.2018,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -5530,7 +5532,7 @@ trace
                             },
                             {
                               "access_type": "scan",
-                              "cost": 2,
+                              "cost": 2.4,
                               "rows": 2,
                               "cause": "cost",
                               "chosen": false
@@ -5569,7 +5571,7 @@ trace
                         },
                         {
                           "access_type": "scan",
-                          "cost": 2,
+                          "cost": 2.4,
                           "rows": 2,
                           "cause": "cost",
                           "chosen": false
@@ -5594,7 +5596,7 @@ trace
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 1,
-                              "cost": 2.0018,
+                              "cost": 2.2018,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -5626,7 +5628,7 @@ trace
                     {
                       "access_type": "scan",
                       "rows": 1,
-                      "cost": 2.0017,
+                      "cost": 2.2017,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -5653,7 +5655,7 @@ trace
                     },
                     {
                       "access_type": "scan",
-                      "cost": 2,
+                      "cost": 2.4,
                       "rows": 2,
                       "cause": "cost",
                       "chosen": false
@@ -5677,7 +5679,7 @@ trace
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 1,
-                          "cost": 2.0018,
+                          "cost": 2.2018,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -5700,7 +5702,7 @@ trace
                               "access_type": "scan",
                               "using_join_cache": true,
                               "rows": 1,
-                              "cost": 2.0018,
+                              "cost": 2.2018,
                               "chosen": true
                             }
                           ] /* considered_access_paths */
@@ -5719,7 +5721,7 @@ trace
                                       {
                                         "access_type": "scan",
                                         "rows": 1,
-                                        "cost": 2.0017,
+                                        "cost": 2.2017,
                                         "chosen": true
                                       }
                                     ] /* considered_access_paths */
@@ -5732,7 +5734,7 @@ trace
                                       {
                                         "access_type": "scan",
                                         "rows": 1,
-                                        "cost": 2.0017,
+                                        "cost": 2.2017,
                                         "chosen": true
                                       }
                                     ] /* considered_access_paths */
@@ -5768,7 +5770,7 @@ trace
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 1,
-                          "cost": 2.0018,
+                          "cost": 2.2018,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -5792,7 +5794,7 @@ trace
                           {
                             "access_type": "scan",
                             "rows": 1,
-                            "cost": 2.0017,
+                            "cost": 2.2017,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -5805,7 +5807,7 @@ trace
                           {
                             "access_type": "scan",
                             "rows": 1,
-                            "cost": 2.0017,
+                            "cost": 2.2017,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -5938,7 +5940,7 @@ select * from t1 left join t2 on t2.a=50
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0034,
+                      "cost": 2.4034,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -5957,7 +5959,7 @@ select * from t1 left join t2 on t2.a=50
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 2,
-                          "cost": 2.0036,
+                          "cost": 2.8036,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -6126,7 +6128,7 @@ select * from t1 where (t1.a,t1.b) not i
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0044,
+                      "cost": 2.4044,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -6246,7 +6248,7 @@ select * from t1 where (t1.a,t1.b) not i
                                 {
                                   "access_type": "scan",
                                   "rows": 2,
-                                  "cost": 2.0044,
+                                  "cost": 2.4044,
                                   "chosen": true
                                 }
                               ] /* considered_access_paths */
@@ -6420,7 +6422,7 @@ trace
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0044,
+                      "cost": 2.4044,
                       "chosen": true,
                       "use_tmp_table": true
                     }
@@ -6440,7 +6442,7 @@ trace
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 2,
-                          "cost": 2.0045,
+                          "cost": 2.8045,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -6462,7 +6464,7 @@ trace
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0044,
+                      "cost": 2.4044,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -6673,6 +6675,7 @@ update t6 set d=5 where d is NULL	{
               "rows": 1,
               "cost": 2.21,
               "rowid_ordered": true,
+              "using_mrr": false,
               "chosen": true
             }
           ] /* range_scan_alternatives */,
@@ -6737,6 +6740,7 @@ delete from t6 where d=5	{
               "rows": 1,
               "cost": 2.21,
               "rowid_ordered": true,
+              "using_mrr": false,
               "chosen": true
             }
           ] /* range_scan_alternatives */
@@ -6860,6 +6864,7 @@ insert into t6 select * from t6 where d>
                         "rows": 2,
                         "cost": 3.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -6884,7 +6889,7 @@ insert into t6 select * from t6 where d>
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.2051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -7044,6 +7049,7 @@ update t5, t6 set t6.d=t6.d+t5.c+4-t5.c-
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       }
                     ] /* range_scan_alternatives */,
@@ -7081,7 +7087,7 @@ update t5, t6 set t6.d=t6.d+t5.c+4-t5.c-
                     {
                       "access_type": "range",
                       "rows": 1,
-                      "cost": 2.21,
+                      "cost": 2.41,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -7246,6 +7252,7 @@ delete t6 from t5, t6 where d>7000	{
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -7271,7 +7278,7 @@ delete t6 from t5, t6 where d>7000	{
                     {
                       "access_type": "scan",
                       "rows": 1,
-                      "cost": 2.6068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -7656,7 +7663,7 @@ select * from t6 where d in (select f1()
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0212,
+                            "cost": 2.6212,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -7681,7 +7688,7 @@ select * from t6 where d in (select f1()
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0212,
+                      "cost": 2.6212,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -7702,7 +7709,7 @@ select * from t6 where d in (select f1()
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 4,
-                          "cost": 2.0076,
+                          "cost": 4.4076,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -7731,7 +7738,7 @@ select * from t6 where d in (select f1()
                     {
                       "access_type": "scan",
                       "rows": 4,
-                      "cost": 2.0068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -7869,7 +7876,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -7987,7 +7994,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8105,7 +8112,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8223,7 +8230,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8433,7 +8440,7 @@ select d into res from t6 where d in (se
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0212,
+                            "cost": 2.6212,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -8458,7 +8465,7 @@ select d into res from t6 where d in (se
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0212,
+                      "cost": 2.6212,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8479,7 +8486,7 @@ select d into res from t6 where d in (se
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 4,
-                          "cost": 2.0076,
+                          "cost": 4.4076,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -8508,7 +8515,7 @@ select d into res from t6 where d in (se
                     {
                       "access_type": "scan",
                       "rows": 4,
-                      "cost": 2.0068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8646,7 +8653,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8764,7 +8771,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8882,7 +8889,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9000,7 +9007,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9271,6 +9278,7 @@ insert into t2 select d,100,200 from t6 
                         "rows": 4,
                         "cost": 1.8798,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -9295,7 +9303,7 @@ insert into t2 select d,100,200 from t6 
                     {
                       "access_type": "scan",
                       "rows": 4,
-                      "cost": 2.0068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9413,7 +9421,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9535,7 +9543,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9657,7 +9665,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9779,7 +9787,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9921,7 +9929,7 @@ select @trace;
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -10126,7 +10134,7 @@ select d into res from t6 where d in (se
                           {
                             "access_type": "scan",
                             "rows": 7,
-                            "cost": 2.0496,
+                            "cost": 3.4496,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -10151,7 +10159,7 @@ select d into res from t6 where d in (se
                     {
                       "access_type": "scan",
                       "rows": 4,
-                      "cost": 2.0068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -10172,7 +10180,7 @@ select d into res from t6 where d in (se
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 7,
-                          "cost": 2.0499,
+                          "cost": 7.6499,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -10192,7 +10200,7 @@ select d into res from t6 where d in (se
                                     "access_type": "scan",
                                     "using_join_cache": true,
                                     "rows": 7,
-                                    "cost": 2.0499,
+                                    "cost": 7.6499,
                                     "chosen": true
                                   }
                                 ] /* considered_access_paths */
@@ -10232,7 +10240,7 @@ select d into res from t6 where d in (se
                     {
                       "access_type": "scan",
                       "rows": 7,
-                      "cost": 2.0496,
+                      "cost": 3.4496,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -10375,7 +10383,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -10493,7 +10501,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -10611,7 +10619,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -10729,7 +10737,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -10881,7 +10889,7 @@ explain select * from v1 where id="b"	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -11052,7 +11060,7 @@ explain select * from v1 where id="b"	{
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0154,
+                            "cost": 2.6154,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -11152,7 +11160,7 @@ explain select * from v1 where id="b"	{
                     },
                     {
                       "access_type": "scan",
-                      "cost": 10,
+                      "cost": 10.4,
                       "rows": 2,
                       "cause": "cost",
                       "chosen": false
@@ -11308,7 +11316,7 @@ VARIABLE_NAME="optimizer_trace"	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 10.1,
+                      "cost": 10.5,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -11467,7 +11475,7 @@ select TRACE into dumpfile 'MYSQLTEST_VA
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 10.1,
+                      "cost": 10.5,
                       "chosen": true
                     }
                   ]

=== modified file 'mysql-test/suite/opt_trace/r/general_ps_prot_none.result'
--- a/mysql-test/suite/opt_trace/r/general_ps_prot_none.result	2012-05-23 15:13:27 +0000
+++ b/mysql-test/suite/opt_trace/r/general_ps_prot_none.result	2012-06-05 07:13:40 +0000
@@ -1523,6 +1523,7 @@ explain SELECT c FROM t5 where c+1 in (s
                               "rows": 1,
                               "cost": 2.21,
                               "rowid_ordered": true,
+                              "using_mrr": false,
                               "chosen": false,
                               "cause": "cost"
                             }
@@ -1553,7 +1554,7 @@ explain SELECT c FROM t5 where c+1 in (s
                           },
                           {
                             "access_type": "scan",
-                            "cost": 2,
+                            "cost": 2.4,
                             "rows": 2,
                             "cause": "cost",
                             "chosen": false
@@ -1804,6 +1805,7 @@ explain SELECT c FROM t5 where c+1 in (s
                               "rows": 1,
                               "cost": 2.21,
                               "rowid_ordered": true,
+                              "using_mrr": false,
                               "chosen": false,
                               "cause": "cost"
                             }
@@ -1834,7 +1836,7 @@ explain SELECT c FROM t5 where c+1 in (s
                           },
                           {
                             "access_type": "scan",
-                            "cost": 2,
+                            "cost": 2.4,
                             "rows": 2,
                             "cause": "cost",
                             "chosen": false
@@ -1991,7 +1993,7 @@ explain extended select * from t1 where 
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0054,
+                      "cost": 2.4054,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2067,7 +2069,7 @@ explain extended select * from t1 where 
                           {
                             "access_type": "scan",
                             "rows": 2,
-                            "cost": 2.0054,
+                            "cost": 2.4054,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -2219,7 +2221,7 @@ explain extended select * from t1 where 
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0054,
+                      "cost": 2.4054,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2295,7 +2297,7 @@ explain extended select * from t1 where 
                           {
                             "access_type": "scan",
                             "rows": 2,
-                            "cost": 2.0054,
+                            "cost": 2.4054,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -2457,7 +2459,7 @@ explain extended select * from t1 where 
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0054,
+                      "cost": 2.4054,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2557,7 +2559,7 @@ explain extended select * from t1 where 
                           {
                             "access_type": "scan",
                             "rows": 2,
-                            "cost": 2.0054,
+                            "cost": 2.4054,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -2719,7 +2721,7 @@ explain extended select * from t1 where 
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0054,
+                      "cost": 2.4054,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2819,7 +2821,7 @@ explain extended select * from t1 where 
                           {
                             "access_type": "scan",
                             "rows": 2,
-                            "cost": 2.0054,
+                            "cost": 2.4054,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -2942,7 +2944,7 @@ explain select * from t1,t2	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0034,
+                      "cost": 2.4034,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2961,7 +2963,7 @@ explain select * from t1,t2	{
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 3,
-                          "cost": 2.0053,
+                          "cost": 3.2053,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -2981,7 +2983,7 @@ explain select * from t1,t2	{
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -3000,7 +3002,7 @@ explain select * from t1,t2	{
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 2,
-                          "cost": 2.0036,
+                          "cost": 3.2036,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -3308,7 +3310,7 @@ where a1 in (select b1 from t2_16 where 
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0293,
+                      "cost": 2.6293,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -3408,7 +3410,7 @@ where a1 in (select b1 from t2_16 where 
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0293,
+                            "cost": 2.6293,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -3593,7 +3595,7 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -3612,7 +3614,7 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 3,
-                          "cost": 2.0054,
+                          "cost": 3.8054,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -3632,7 +3634,7 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -3744,7 +3746,7 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2
                                 {
                                   "access_type": "scan",
                                   "rows": 3,
-                                  "cost": 2.0051,
+                                  "cost": 2.6051,
                                   "chosen": true
                                 }
                               ] /* considered_access_paths */
@@ -3922,7 +3924,7 @@ SELECT * FROM t1 WHERE c1=5 UNION SELECT
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -4018,7 +4020,7 @@ SELECT * FROM t1 WHERE c1=5 UNION SELECT
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -4114,7 +4116,7 @@ SELECT * FROM t1 WHERE c1=5 UNION SELECT
                     {
                       "access_type": "scan",
                       "rows": 1,
-                      "cost": 10.05,
+                      "cost": 10.25,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -4312,7 +4314,7 @@ concat(c1,'y') IN
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -4412,7 +4414,7 @@ concat(c1,'y') IN
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0051,
+                            "cost": 2.6051,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -4515,7 +4517,7 @@ concat(c1,'y') IN
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0051,
+                            "cost": 2.6051,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -5015,7 +5017,7 @@ select * from t1 left join t2 on t2.a=50
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0034,
+                      "cost": 2.4034,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -5034,7 +5036,7 @@ select * from t1 left join t2 on t2.a=50
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 2,
-                          "cost": 2.0036,
+                          "cost": 2.8036,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -5194,7 +5196,7 @@ select * from t1 where (t1.a,t1.b) not i
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0044,
+                      "cost": 2.4044,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -5314,7 +5316,7 @@ select * from t1 where (t1.a,t1.b) not i
                                 {
                                   "access_type": "scan",
                                   "rows": 2,
-                                  "cost": 2.0044,
+                                  "cost": 2.4044,
                                   "chosen": true
                                 }
                               ] /* considered_access_paths */
@@ -5488,7 +5490,7 @@ trace
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0044,
+                      "cost": 2.4044,
                       "chosen": true,
                       "use_tmp_table": true
                     }
@@ -5508,7 +5510,7 @@ trace
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 2,
-                          "cost": 2.0045,
+                          "cost": 2.8045,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -5530,7 +5532,7 @@ trace
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0044,
+                      "cost": 2.4044,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -5741,6 +5743,7 @@ update t6 set d=5 where d is NULL	{
               "rows": 1,
               "cost": 2.21,
               "rowid_ordered": true,
+              "using_mrr": false,
               "chosen": true
             }
           ] /* range_scan_alternatives */,
@@ -5805,6 +5808,7 @@ delete from t6 where d=5	{
               "rows": 1,
               "cost": 2.21,
               "rowid_ordered": true,
+              "using_mrr": false,
               "chosen": true
             }
           ] /* range_scan_alternatives */
@@ -5928,6 +5932,7 @@ insert into t6 select * from t6 where d>
                         "rows": 2,
                         "cost": 3.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -5952,7 +5957,7 @@ insert into t6 select * from t6 where d>
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.2051,
+                      "cost": 2.6051,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -6112,6 +6117,7 @@ update t5, t6 set t6.d=t6.d+t5.c+4-t5.c-
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       }
                     ] /* range_scan_alternatives */,
@@ -6149,7 +6155,7 @@ update t5, t6 set t6.d=t6.d+t5.c+4-t5.c-
                     {
                       "access_type": "range",
                       "rows": 1,
-                      "cost": 2.21,
+                      "cost": 2.41,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -6314,6 +6320,7 @@ delete t6 from t5, t6 where d>7000	{
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -6339,7 +6346,7 @@ delete t6 from t5, t6 where d>7000	{
                     {
                       "access_type": "scan",
                       "rows": 1,
-                      "cost": 2.6068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -6701,7 +6708,7 @@ select * from t6 where d in (select f1()
                     {
                       "access_type": "scan",
                       "rows": 4,
-                      "cost": 2.0068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -6805,7 +6812,7 @@ select * from t6 where d in (select f1()
                                 {
                                   "access_type": "scan",
                                   "rows": 3,
-                                  "cost": 2.0212,
+                                  "cost": 2.6212,
                                   "chosen": true
                                 }
                               ] /* considered_access_paths */
@@ -6967,7 +6974,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -7085,7 +7092,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -7203,7 +7210,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -7321,7 +7328,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -7508,7 +7515,7 @@ select d into res from t6 where d in (se
                     {
                       "access_type": "scan",
                       "rows": 4,
-                      "cost": 2.0068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -7612,7 +7619,7 @@ select d into res from t6 where d in (se
                                 {
                                   "access_type": "scan",
                                   "rows": 3,
-                                  "cost": 2.0212,
+                                  "cost": 2.6212,
                                   "chosen": true
                                 }
                               ] /* considered_access_paths */
@@ -7774,7 +7781,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -7892,7 +7899,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8010,7 +8017,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8128,7 +8135,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8399,6 +8406,7 @@ insert into t2 select d,100,200 from t6 
                         "rows": 4,
                         "cost": 1.8798,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -8423,7 +8431,7 @@ insert into t2 select d,100,200 from t6 
                     {
                       "access_type": "scan",
                       "rows": 4,
-                      "cost": 2.0068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8541,7 +8549,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8663,7 +8671,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8785,7 +8793,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -8907,7 +8915,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9049,7 +9057,7 @@ select @trace;
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9231,7 +9239,7 @@ select d into res from t6 where d in (se
                     {
                       "access_type": "scan",
                       "rows": 4,
-                      "cost": 2.0068,
+                      "cost": 2.8068,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9335,7 +9343,7 @@ select d into res from t6 where d in (se
                                 {
                                   "access_type": "scan",
                                   "rows": 7,
-                                  "cost": 2.0496,
+                                  "cost": 3.4496,
                                   "chosen": true
                                 }
                               ] /* considered_access_paths */
@@ -9497,7 +9505,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9615,7 +9623,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9733,7 +9741,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -9851,7 +9859,7 @@ select sum(data) into ret from t1	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -10003,7 +10011,7 @@ explain select * from v1 where id="b"	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0154,
+                      "cost": 2.4154,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -10174,7 +10182,7 @@ explain select * from v1 where id="b"	{
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0154,
+                            "cost": 2.6154,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -10274,7 +10282,7 @@ explain select * from v1 where id="b"	{
                     },
                     {
                       "access_type": "scan",
-                      "cost": 10,
+                      "cost": 10.4,
                       "rows": 2,
                       "cause": "cost",
                       "chosen": false
@@ -10430,7 +10438,7 @@ VARIABLE_NAME="optimizer_trace"	{
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 10.1,
+                      "cost": 10.5,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -10589,7 +10597,7 @@ select TRACE into dumpfile 'MYSQLTEST_VA
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 10.1,
+                      "cost": 10.5,
                       "chosen": true
                     }
                   ]

=== modified file 'mysql-test/suite/opt_trace/r/range_no_prot.result'
--- a/mysql-test/suite/opt_trace/r/range_no_prot.result	2012-05-18 09:44:26 +0000
+++ b/mysql-test/suite/opt_trace/r/range_no_prot.result	2012-06-05 07:13:40 +0000
@@ -165,6 +165,7 @@ EXPLAIN SELECT * FROM t1 WHERE key2 < 5 
                         "rows": 47,
                         "cost": 58.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       }
                     ] /* range_scan_alternatives */,
@@ -202,7 +203,7 @@ EXPLAIN SELECT * FROM t1 WHERE key2 < 5 
                     {
                       "access_type": "range",
                       "rows": 47,
-                      "cost": 58.41,
+                      "cost": 67.81,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -350,7 +351,7 @@ EXPLAIN SELECT * FROM t1 WHERE key2 < 5 
                     {
                       "access_type": "range",
                       "rows": 47,
-                      "cost": 58.41,
+                      "cost": 67.81,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -531,6 +532,7 @@ EXPLAIN SELECT * FROM t1 WHERE key1 < 3 
                               "rows": 3,
                               "cost": 1.6526,
                               "rowid_ordered": false,
+                              "using_mrr": false,
                               "chosen": true
                             }
                           ] /* range_scan_alternatives */,
@@ -549,6 +551,7 @@ EXPLAIN SELECT * FROM t1 WHERE key1 < 3 
                               "rows": 42,
                               "cost": 10.282,
                               "rowid_ordered": false,
+                              "using_mrr": false,
                               "chosen": true
                             }
                           ] /* range_scan_alternatives */,
@@ -603,7 +606,7 @@ EXPLAIN SELECT * FROM t1 WHERE key1 < 3 
                     {
                       "access_type": "range",
                       "rows": 45,
-                      "cost": 58.363,
+                      "cost": 67.363,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -808,7 +811,7 @@ EXPLAIN SELECT key2, MIN(key2_1) FROM t2
                     {
                       "access_type": "range",
                       "rows": 103,
-                      "cost": 50.6,
+                      "cost": 71.2,
                       "chosen": true,
                       "use_tmp_table": true
                     }
@@ -1033,7 +1036,7 @@ EXPLAIN SELECT DISTINCT key2 FROM t2	{
                     {
                       "access_type": "range",
                       "rows": 103,
-                      "cost": 50.6,
+                      "cost": 71.2,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -1280,6 +1283,7 @@ GROUP BY key2	{
                         "rows": 47,
                         "cost": 11.724,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       },
                       {
@@ -1296,6 +1300,7 @@ GROUP BY key2	{
                         "rows": 47,
                         "cost": 11.724,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -1337,7 +1342,7 @@ GROUP BY key2	{
                     {
                       "access_type": "range",
                       "rows": 5,
-                      "cost": 20.124,
+                      "cost": 21.124,
                       "chosen": true,
                       "use_tmp_table": true
                     }
@@ -1526,6 +1531,7 @@ EXPLAIN SELECT * FROM t2 WHERE key2 = 1 
                         "rows": 10,
                         "cost": 13.01,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       },
                       {
@@ -1538,6 +1544,7 @@ EXPLAIN SELECT * FROM t2 WHERE key2 = 1 
                         "rows": 10,
                         "cost": 13.01,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -1772,6 +1779,7 @@ EXPLAIN SELECT * FROM t1 WHERE key2=10 O
                               "rows": 1,
                               "cost": 2.21,
                               "rowid_ordered": true,
+                              "using_mrr": false,
                               "chosen": true
                             }
                           ] /* range_scan_alternatives */,
@@ -1790,6 +1798,7 @@ EXPLAIN SELECT * FROM t1 WHERE key2=10 O
                               "rows": 1,
                               "cost": 2.21,
                               "rowid_ordered": true,
+                              "using_mrr": false,
                               "chosen": true
                             }
                           ] /* range_scan_alternatives */,
@@ -1872,7 +1881,7 @@ EXPLAIN SELECT * FROM t1 WHERE key2=10 O
                     {
                       "access_type": "range",
                       "rows": 2,
-                      "cost": 6.327,
+                      "cost": 6.727,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2034,7 +2043,7 @@ EXPLAIN SELECT * FROM t2 WHERE key2_1 < 
                     {
                       "access_type": "scan",
                       "rows": 1024,
-                      "cost": 8.25,
+                      "cost": 213.05,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2197,6 +2206,7 @@ EXPLAIN SELECT * FROM t2 WHERE key1a = 5
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       },
                       {
@@ -2209,6 +2219,7 @@ EXPLAIN SELECT * FROM t2 WHERE key1a = 5
                         "rows": 9,
                         "cost": 11.81,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -2253,7 +2264,7 @@ EXPLAIN SELECT * FROM t2 WHERE key1a = 5
                     {
                       "access_type": "range",
                       "rows": 1,
-                      "cost": 2.21,
+                      "cost": 2.41,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2415,6 +2426,7 @@ EXPLAIN SELECT * FROM t2 WHERE (key1a = 
                         "rows": 2,
                         "cost": 4.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       },
                       {
@@ -2429,6 +2441,7 @@ EXPLAIN SELECT * FROM t2 WHERE (key1a = 
                         "rows": 6,
                         "cost": 10.21,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -2467,7 +2480,7 @@ EXPLAIN SELECT * FROM t2 WHERE (key1a = 
                     {
                       "access_type": "range",
                       "rows": 2,
-                      "cost": 4.41,
+                      "cost": 4.81,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2629,6 +2642,7 @@ EXPLAIN SELECT * FROM t2 WHERE (key1b < 
                         "rows": 2,
                         "cost": 4.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       },
                       {
@@ -2642,6 +2656,7 @@ EXPLAIN SELECT * FROM t2 WHERE (key1b < 
                         "rows": 2,
                         "cost": 3.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       }
                     ] /* range_scan_alternatives */,
@@ -2679,7 +2694,7 @@ EXPLAIN SELECT * FROM t2 WHERE (key1b < 
                     {
                       "access_type": "range",
                       "rows": 2,
-                      "cost": 3.41,
+                      "cost": 3.81,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2859,6 +2874,7 @@ EXPLAIN SELECT * FROM t1 WHERE (key1 > 1
                               "rows": 1023,
                               "cost": 227.35,
                               "rowid_ordered": false,
+                              "using_mrr": false,
                               "chosen": false,
                               "cause": "cost"
                             }
@@ -2878,6 +2894,7 @@ EXPLAIN SELECT * FROM t1 WHERE (key1 > 1
                               "rows": 1022,
                               "cost": 227.13,
                               "rowid_ordered": false,
+                              "using_mrr": false,
                               "chosen": false,
                               "cause": "cost"
                             }
@@ -2906,7 +2923,7 @@ EXPLAIN SELECT * FROM t1 WHERE (key1 > 1
                     {
                       "access_type": "scan",
                       "rows": 1024,
-                      "cost": 10.25,
+                      "cost": 215.05,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -3102,6 +3119,7 @@ WHERE t1.key1=t2.key1a AND t1.key2 > 102
                         "rows": 42,
                         "cost": 51.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       }
                     ] /* range_scan_alternatives */,
@@ -3151,7 +3169,7 @@ WHERE t1.key1=t2.key1a AND t1.key2 > 102
                     {
                       "access_type": "range",
                       "rows": 42,
-                      "cost": 51.41,
+                      "cost": 59.81,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -3177,7 +3195,7 @@ WHERE t1.key1=t2.key1a AND t1.key2 > 102
                       "access_type": "scan",
                       "using_join_cache": true,
                       "rows": 768,
-                      "cost": 59.535,
+                      "cost": 6510.7,
                       "chosen": false
                     }
                   ] /* considered_access_paths */
@@ -3352,6 +3370,7 @@ EXPLAIN SELECT * FROM t1 WHERE cola = 'f
                         "rows": 533,
                         "cost": 640.61,
                         "rowid_ordered": true,
+                        "using_mrr": false,
                         "chosen": true
                       },
                       {
@@ -3364,6 +3383,7 @@ EXPLAIN SELECT * FROM t1 WHERE cola = 'f
                         "rows": 533,
                         "cost": 640.61,
                         "rowid_ordered": true,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -3454,7 +3474,7 @@ EXPLAIN SELECT * FROM t1 WHERE cola = 'f
                     {
                       "access_type": "range",
                       "rows": 24,
-                      "cost": 54.959,
+                      "cost": 59.759,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -3603,6 +3623,7 @@ EXPLAIN SELECT * FROM t1 WHERE cola = 'f
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": true,
+                        "using_mrr": false,
                         "chosen": true
                       }
                     ] /* range_scan_alternatives */,
@@ -3839,6 +3860,7 @@ EXPLAIN SELECT 1 FROM 
                                   "rows": 18446744073709551615,
                                   "cost": 0,
                                   "rowid_ordered": false,
+                                  "using_mrr": true,
                                   "chosen": false,
                                   "cause": "cost"
                                 }
@@ -4177,6 +4199,7 @@ EXPLAIN SELECT 1 FROM 
                                   "rows": 18446744073709551615,
                                   "cost": 0,
                                   "rowid_ordered": false,
+                                  "using_mrr": true,
                                   "chosen": false,
                                   "cause": "cost"
                                 }
@@ -4449,6 +4472,7 @@ EXPLAIN SELECT * FROM t1 WHERE i1 > '2' 
                         "rows": 2,
                         "cost": 3.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       },
                       {
@@ -4461,6 +4485,7 @@ EXPLAIN SELECT * FROM t1 WHERE i1 > '2' 
                         "rows": 2,
                         "cost": 3.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -4498,7 +4523,7 @@ EXPLAIN SELECT * FROM t1 WHERE i1 > '2' 
                     {
                       "access_type": "range",
                       "rows": 2,
-                      "cost": 3.41,
+                      "cost": 3.81,
                       "chosen": true,
                       "use_tmp_table": true
                     }
@@ -4594,6 +4619,7 @@ EXPLAIN SELECT * FROM t1 WHERE i1 > '2' 
                         "rows": 2,
                         "cost": 3.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       }
                     ] /* range_scan_alternatives */,
@@ -4785,6 +4811,7 @@ EXPLAIN SELECT DISTINCT i1 FROM t1 WHERE
                         "rows": 2,
                         "cost": 3.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       },
@@ -4798,6 +4825,7 @@ EXPLAIN SELECT DISTINCT i1 FROM t1 WHERE
                         "rows": 2,
                         "cost": 3.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -4822,7 +4850,7 @@ EXPLAIN SELECT DISTINCT i1 FROM t1 WHERE
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0049,
+                      "cost": 2.4049,
                       "chosen": true,
                       "use_tmp_table": true
                     }
@@ -4909,6 +4937,7 @@ EXPLAIN SELECT DISTINCT i1 FROM t1 WHERE
                         "rows": 2,
                         "cost": 3.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -5123,6 +5152,7 @@ EXPLAIN SELECT v FROM t1 WHERE i1 = 1 AN
                         "rows": 2,
                         "cost": 2.41,
                         "rowid_ordered": true,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       },
@@ -5136,6 +5166,7 @@ EXPLAIN SELECT v FROM t1 WHERE i1 = 1 AN
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": true,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       },
@@ -5149,6 +5180,7 @@ EXPLAIN SELECT v FROM t1 WHERE i1 = 1 AN
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": true,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -5426,6 +5458,7 @@ EXPLAIN SELECT v FROM t1 WHERE i1 = 1 AN
                         "rows": 2,
                         "cost": 2.41,
                         "rowid_ordered": true,
+                        "using_mrr": false,
                         "chosen": true
                       },
                       {
@@ -5438,6 +5471,7 @@ EXPLAIN SELECT v FROM t1 WHERE i1 = 1 AN
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": true,
+                        "using_mrr": false,
                         "chosen": true
                       },
                       {
@@ -5450,6 +5484,7 @@ EXPLAIN SELECT v FROM t1 WHERE i1 = 1 AN
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": true,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -5540,7 +5575,7 @@ EXPLAIN SELECT v FROM t1 WHERE i1 = 1 AN
                     {
                       "access_type": "range",
                       "rows": 1,
-                      "cost": 1.1,
+                      "cost": 1.3,
                       "chosen": false
                     }
                   ] /* considered_access_paths */
@@ -5735,6 +5770,7 @@ EXPLAIN SELECT MAX(b), a FROM t1 WHERE b
                         "rows": 1,
                         "cost": 1.21,
                         "rowid_ordered": true,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       },
@@ -5748,6 +5784,7 @@ EXPLAIN SELECT MAX(b), a FROM t1 WHERE b
                         "rows": 2,
                         "cost": 3.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -5800,7 +5837,7 @@ EXPLAIN SELECT MAX(b), a FROM t1 WHERE b
                     {
                       "access_type": "range",
                       "rows": 1,
-                      "cost": 1.2,
+                      "cost": 1.4,
                       "chosen": false
                     }
                   ] /* considered_access_paths */
@@ -5994,6 +6031,7 @@ EXPLAIN SELECT * FROM t1 WHERE c1 = '1' 
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": true,
+                        "using_mrr": false,
                         "chosen": true
                       },
                       {
@@ -6006,6 +6044,7 @@ EXPLAIN SELECT * FROM t1 WHERE c1 = '1' 
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }

=== modified file 'mysql-test/suite/opt_trace/r/range_ps_prot.result'
--- a/mysql-test/suite/opt_trace/r/range_ps_prot.result	2012-05-21 19:57:40 +0000
+++ b/mysql-test/suite/opt_trace/r/range_ps_prot.result	2012-06-05 07:13:40 +0000
@@ -165,6 +165,7 @@ EXPLAIN SELECT * FROM t1 WHERE key2 < 5 
                         "rows": 47,
                         "cost": 58.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       }
                     ] /* range_scan_alternatives */,
@@ -202,7 +203,7 @@ EXPLAIN SELECT * FROM t1 WHERE key2 < 5 
                     {
                       "access_type": "range",
                       "rows": 47,
-                      "cost": 58.41,
+                      "cost": 67.81,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -350,7 +351,7 @@ EXPLAIN SELECT * FROM t1 WHERE key2 < 5 
                     {
                       "access_type": "range",
                       "rows": 47,
-                      "cost": 58.41,
+                      "cost": 67.81,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -531,6 +532,7 @@ EXPLAIN SELECT * FROM t1 WHERE key1 < 3 
                               "rows": 3,
                               "cost": 1.6526,
                               "rowid_ordered": false,
+                              "using_mrr": false,
                               "chosen": true
                             }
                           ] /* range_scan_alternatives */,
@@ -549,6 +551,7 @@ EXPLAIN SELECT * FROM t1 WHERE key1 < 3 
                               "rows": 42,
                               "cost": 10.282,
                               "rowid_ordered": false,
+                              "using_mrr": false,
                               "chosen": true
                             }
                           ] /* range_scan_alternatives */,
@@ -603,7 +606,7 @@ EXPLAIN SELECT * FROM t1 WHERE key1 < 3 
                     {
                       "access_type": "range",
                       "rows": 45,
-                      "cost": 58.363,
+                      "cost": 67.363,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -808,7 +811,7 @@ EXPLAIN SELECT key2, MIN(key2_1) FROM t2
                     {
                       "access_type": "range",
                       "rows": 103,
-                      "cost": 50.6,
+                      "cost": 71.2,
                       "chosen": true,
                       "use_tmp_table": true
                     }
@@ -1033,7 +1036,7 @@ EXPLAIN SELECT DISTINCT key2 FROM t2	{
                     {
                       "access_type": "range",
                       "rows": 103,
-                      "cost": 50.6,
+                      "cost": 71.2,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -1280,6 +1283,7 @@ GROUP BY key2	{
                         "rows": 47,
                         "cost": 11.724,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       },
                       {
@@ -1296,6 +1300,7 @@ GROUP BY key2	{
                         "rows": 47,
                         "cost": 11.724,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -1337,7 +1342,7 @@ GROUP BY key2	{
                     {
                       "access_type": "range",
                       "rows": 5,
-                      "cost": 20.124,
+                      "cost": 21.124,
                       "chosen": true,
                       "use_tmp_table": true
                     }
@@ -1526,6 +1531,7 @@ EXPLAIN SELECT * FROM t2 WHERE key2 = 1 
                         "rows": 10,
                         "cost": 13.01,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       },
                       {
@@ -1538,6 +1544,7 @@ EXPLAIN SELECT * FROM t2 WHERE key2 = 1 
                         "rows": 10,
                         "cost": 13.01,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -1772,6 +1779,7 @@ EXPLAIN SELECT * FROM t1 WHERE key2=10 O
                               "rows": 1,
                               "cost": 2.21,
                               "rowid_ordered": true,
+                              "using_mrr": false,
                               "chosen": true
                             }
                           ] /* range_scan_alternatives */,
@@ -1790,6 +1798,7 @@ EXPLAIN SELECT * FROM t1 WHERE key2=10 O
                               "rows": 1,
                               "cost": 2.21,
                               "rowid_ordered": true,
+                              "using_mrr": false,
                               "chosen": true
                             }
                           ] /* range_scan_alternatives */,
@@ -1872,7 +1881,7 @@ EXPLAIN SELECT * FROM t1 WHERE key2=10 O
                     {
                       "access_type": "range",
                       "rows": 2,
-                      "cost": 6.327,
+                      "cost": 6.727,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2034,7 +2043,7 @@ EXPLAIN SELECT * FROM t2 WHERE key2_1 < 
                     {
                       "access_type": "scan",
                       "rows": 1024,
-                      "cost": 8.25,
+                      "cost": 213.05,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2197,6 +2206,7 @@ EXPLAIN SELECT * FROM t2 WHERE key1a = 5
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       },
                       {
@@ -2209,6 +2219,7 @@ EXPLAIN SELECT * FROM t2 WHERE key1a = 5
                         "rows": 9,
                         "cost": 11.81,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -2253,7 +2264,7 @@ EXPLAIN SELECT * FROM t2 WHERE key1a = 5
                     {
                       "access_type": "range",
                       "rows": 1,
-                      "cost": 2.21,
+                      "cost": 2.41,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2415,6 +2426,7 @@ EXPLAIN SELECT * FROM t2 WHERE (key1a = 
                         "rows": 2,
                         "cost": 4.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       },
                       {
@@ -2429,6 +2441,7 @@ EXPLAIN SELECT * FROM t2 WHERE (key1a = 
                         "rows": 6,
                         "cost": 10.21,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -2467,7 +2480,7 @@ EXPLAIN SELECT * FROM t2 WHERE (key1a = 
                     {
                       "access_type": "range",
                       "rows": 2,
-                      "cost": 4.41,
+                      "cost": 4.81,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2629,6 +2642,7 @@ EXPLAIN SELECT * FROM t2 WHERE (key1b < 
                         "rows": 2,
                         "cost": 4.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       },
                       {
@@ -2642,6 +2656,7 @@ EXPLAIN SELECT * FROM t2 WHERE (key1b < 
                         "rows": 2,
                         "cost": 3.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       }
                     ] /* range_scan_alternatives */,
@@ -2679,7 +2694,7 @@ EXPLAIN SELECT * FROM t2 WHERE (key1b < 
                     {
                       "access_type": "range",
                       "rows": 2,
-                      "cost": 3.41,
+                      "cost": 3.81,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2859,6 +2874,7 @@ EXPLAIN SELECT * FROM t1 WHERE (key1 > 1
                               "rows": 1023,
                               "cost": 227.35,
                               "rowid_ordered": false,
+                              "using_mrr": false,
                               "chosen": false,
                               "cause": "cost"
                             }
@@ -2878,6 +2894,7 @@ EXPLAIN SELECT * FROM t1 WHERE (key1 > 1
                               "rows": 1022,
                               "cost": 227.13,
                               "rowid_ordered": false,
+                              "using_mrr": false,
                               "chosen": false,
                               "cause": "cost"
                             }
@@ -2906,7 +2923,7 @@ EXPLAIN SELECT * FROM t1 WHERE (key1 > 1
                     {
                       "access_type": "scan",
                       "rows": 1024,
-                      "cost": 10.25,
+                      "cost": 215.05,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -3102,6 +3119,7 @@ WHERE t1.key1=t2.key1a AND t1.key2 > 102
                         "rows": 42,
                         "cost": 51.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       }
                     ] /* range_scan_alternatives */,
@@ -3151,7 +3169,7 @@ WHERE t1.key1=t2.key1a AND t1.key2 > 102
                     {
                       "access_type": "range",
                       "rows": 42,
-                      "cost": 51.41,
+                      "cost": 59.81,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -3177,7 +3195,7 @@ WHERE t1.key1=t2.key1a AND t1.key2 > 102
                       "access_type": "scan",
                       "using_join_cache": true,
                       "rows": 768,
-                      "cost": 59.535,
+                      "cost": 6510.7,
                       "chosen": false
                     }
                   ] /* considered_access_paths */
@@ -3352,6 +3370,7 @@ EXPLAIN SELECT * FROM t1 WHERE cola = 'f
                         "rows": 533,
                         "cost": 640.61,
                         "rowid_ordered": true,
+                        "using_mrr": false,
                         "chosen": true
                       },
                       {
@@ -3364,6 +3383,7 @@ EXPLAIN SELECT * FROM t1 WHERE cola = 'f
                         "rows": 533,
                         "cost": 640.61,
                         "rowid_ordered": true,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -3454,7 +3474,7 @@ EXPLAIN SELECT * FROM t1 WHERE cola = 'f
                     {
                       "access_type": "range",
                       "rows": 24,
-                      "cost": 54.959,
+                      "cost": 59.759,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -3603,6 +3623,7 @@ EXPLAIN SELECT * FROM t1 WHERE cola = 'f
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": true,
+                        "using_mrr": false,
                         "chosen": true
                       }
                     ] /* range_scan_alternatives */,
@@ -3839,6 +3860,7 @@ EXPLAIN SELECT 1 FROM 
                                   "rows": 18446744073709551615,
                                   "cost": 0,
                                   "rowid_ordered": false,
+                                  "using_mrr": true,
                                   "chosen": false,
                                   "cause": "cost"
                                 }
@@ -4177,6 +4199,7 @@ EXPLAIN SELECT 1 FROM 
                                   "rows": 18446744073709551615,
                                   "cost": 0,
                                   "rowid_ordered": false,
+                                  "using_mrr": true,
                                   "chosen": false,
                                   "cause": "cost"
                                 }
@@ -4449,6 +4472,7 @@ EXPLAIN SELECT * FROM t1 WHERE i1 > '2' 
                         "rows": 2,
                         "cost": 3.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       },
                       {
@@ -4461,6 +4485,7 @@ EXPLAIN SELECT * FROM t1 WHERE i1 > '2' 
                         "rows": 2,
                         "cost": 3.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -4498,7 +4523,7 @@ EXPLAIN SELECT * FROM t1 WHERE i1 > '2' 
                     {
                       "access_type": "range",
                       "rows": 2,
-                      "cost": 3.41,
+                      "cost": 3.81,
                       "chosen": true,
                       "use_tmp_table": true
                     }
@@ -4594,6 +4619,7 @@ EXPLAIN SELECT * FROM t1 WHERE i1 > '2' 
                         "rows": 2,
                         "cost": 3.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       }
                     ] /* range_scan_alternatives */,
@@ -4785,6 +4811,7 @@ EXPLAIN SELECT DISTINCT i1 FROM t1 WHERE
                         "rows": 2,
                         "cost": 3.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       },
@@ -4798,6 +4825,7 @@ EXPLAIN SELECT DISTINCT i1 FROM t1 WHERE
                         "rows": 2,
                         "cost": 3.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -4822,7 +4850,7 @@ EXPLAIN SELECT DISTINCT i1 FROM t1 WHERE
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 2.0049,
+                      "cost": 2.4049,
                       "chosen": true,
                       "use_tmp_table": true
                     }
@@ -4909,6 +4937,7 @@ EXPLAIN SELECT DISTINCT i1 FROM t1 WHERE
                         "rows": 2,
                         "cost": 3.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -5123,6 +5152,7 @@ EXPLAIN SELECT v FROM t1 WHERE i1 = 1 AN
                         "rows": 2,
                         "cost": 2.41,
                         "rowid_ordered": true,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       },
@@ -5136,6 +5166,7 @@ EXPLAIN SELECT v FROM t1 WHERE i1 = 1 AN
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": true,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       },
@@ -5149,6 +5180,7 @@ EXPLAIN SELECT v FROM t1 WHERE i1 = 1 AN
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": true,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -5426,6 +5458,7 @@ EXPLAIN SELECT v FROM t1 WHERE i1 = 1 AN
                         "rows": 2,
                         "cost": 2.41,
                         "rowid_ordered": true,
+                        "using_mrr": false,
                         "chosen": true
                       },
                       {
@@ -5438,6 +5471,7 @@ EXPLAIN SELECT v FROM t1 WHERE i1 = 1 AN
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": true,
+                        "using_mrr": false,
                         "chosen": true
                       },
                       {
@@ -5450,6 +5484,7 @@ EXPLAIN SELECT v FROM t1 WHERE i1 = 1 AN
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": true,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -5540,7 +5575,7 @@ EXPLAIN SELECT v FROM t1 WHERE i1 = 1 AN
                     {
                       "access_type": "range",
                       "rows": 1,
-                      "cost": 1.1,
+                      "cost": 1.3,
                       "chosen": false
                     }
                   ] /* considered_access_paths */
@@ -5735,6 +5770,7 @@ EXPLAIN SELECT MAX(b), a FROM t1 WHERE b
                         "rows": 1,
                         "cost": 1.21,
                         "rowid_ordered": true,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       },
@@ -5748,6 +5784,7 @@ EXPLAIN SELECT MAX(b), a FROM t1 WHERE b
                         "rows": 2,
                         "cost": 3.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -5800,7 +5837,7 @@ EXPLAIN SELECT MAX(b), a FROM t1 WHERE b
                     {
                       "access_type": "range",
                       "rows": 1,
-                      "cost": 1.2,
+                      "cost": 1.4,
                       "chosen": false
                     }
                   ] /* considered_access_paths */
@@ -5994,6 +6031,7 @@ EXPLAIN SELECT * FROM t1 WHERE c1 = '1' 
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": true,
+                        "using_mrr": false,
                         "chosen": true
                       },
                       {
@@ -6006,6 +6044,7 @@ EXPLAIN SELECT * FROM t1 WHERE c1 = '1' 
                         "rows": 1,
                         "cost": 2.21,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }

=== modified file 'mysql-test/suite/opt_trace/r/subquery_no_prot.result'
--- a/mysql-test/suite/opt_trace/r/subquery_no_prot.result	2012-05-31 16:21:37 +0000
+++ b/mysql-test/suite/opt_trace/r/subquery_no_prot.result	2012-06-05 07:13:40 +0000
@@ -1071,7 +1071,7 @@ field4,field5,field6	{
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0342,
+                            "cost": 2.6342,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -1254,6 +1254,7 @@ field4,field5,field6	{
                         "rows": 3,
                         "cost": 5.61,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -1289,7 +1290,7 @@ field4,field5,field6	{
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0342,
+                      "cost": 2.6342,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -1321,7 +1322,7 @@ field4,field5,field6	{
                         },
                         {
                           "access_type": "scan",
-                          "cost": 10,
+                          "cost": 10.6,
                           "rows": 3,
                           "cause": "cost",
                           "chosen": false
@@ -1357,7 +1358,7 @@ field4,field5,field6	{
                     },
                     {
                       "access_type": "scan",
-                      "cost": 10,
+                      "cost": 10.6,
                       "rows": 3,
                       "cause": "cost",
                       "chosen": false
@@ -1379,7 +1380,7 @@ field4,field5,field6	{
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 3,
-                          "cost": 2.0344,
+                          "cost": 2.2144,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -1539,7 +1540,7 @@ field4,field5,field6	{
                                           {
                                             "access_type": "scan",
                                             "rows": 3,
-                                            "cost": 2.0342,
+                                            "cost": 2.6342,
                                             "chosen": true
                                           }
                                         ] /* considered_access_paths */
@@ -1566,7 +1567,7 @@ field4,field5,field6	{
                                                 "access_type": "scan",
                                                 "using_join_cache": true,
                                                 "rows": 3,
-                                                "cost": 2.0344,
+                                                "cost": 3.8344,
                                                 "chosen": true
                                               }
                                             ] /* considered_access_paths */
@@ -1593,7 +1594,7 @@ field4,field5,field6	{
                                           {
                                             "access_type": "scan",
                                             "rows": 3,
-                                            "cost": 2.0342,
+                                            "cost": 2.6342,
                                             "chosen": true
                                           }
                                         ] /* considered_access_paths */
@@ -1952,6 +1953,7 @@ table2.`col_int_nokey` <> any ( select 5
                         "rows": 2,
                         "cost": 4.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       }
                     ] /* range_scan_alternatives */,
@@ -2002,7 +2004,7 @@ table2.`col_int_nokey` <> any ( select 5
                     {
                       "access_type": "range",
                       "rows": 2,
-                      "cost": 4.41,
+                      "cost": 4.81,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -2028,7 +2030,7 @@ table2.`col_int_nokey` <> any ( select 5
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 2,
-                          "cost": 2.0227,
+                          "cost": 2.8227,
                           "chosen": false
                         }
                       ] /* considered_access_paths */
@@ -2107,7 +2109,7 @@ table2.`col_int_nokey` <> any ( select 5
                                           {
                                             "access_type": "scan",
                                             "rows": 2,
-                                            "cost": 2.0225,
+                                            "cost": 2.4225,
                                             "chosen": true
                                           }
                                         ] /* considered_access_paths */

=== modified file 'mysql-test/suite/opt_trace/r/subquery_ps_prot.result'
--- a/mysql-test/suite/opt_trace/r/subquery_ps_prot.result	2012-05-31 16:21:37 +0000
+++ b/mysql-test/suite/opt_trace/r/subquery_ps_prot.result	2012-06-05 07:13:40 +0000
@@ -1049,7 +1049,7 @@ field4,field5,field6	{
                           {
                             "access_type": "scan",
                             "rows": 3,
-                            "cost": 2.0342,
+                            "cost": 2.6342,
                             "chosen": true
                           }
                         ] /* considered_access_paths */
@@ -1232,6 +1232,7 @@ field4,field5,field6	{
                         "rows": 3,
                         "cost": 5.61,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": false,
                         "cause": "cost"
                       }
@@ -1267,7 +1268,7 @@ field4,field5,field6	{
                     {
                       "access_type": "scan",
                       "rows": 3,
-                      "cost": 2.0342,
+                      "cost": 2.6342,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -1299,7 +1300,7 @@ field4,field5,field6	{
                         },
                         {
                           "access_type": "scan",
-                          "cost": 10,
+                          "cost": 10.6,
                           "rows": 3,
                           "cause": "cost",
                           "chosen": false
@@ -1335,7 +1336,7 @@ field4,field5,field6	{
                     },
                     {
                       "access_type": "scan",
-                      "cost": 10,
+                      "cost": 10.6,
                       "rows": 3,
                       "cause": "cost",
                       "chosen": false
@@ -1357,7 +1358,7 @@ field4,field5,field6	{
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 3,
-                          "cost": 2.0344,
+                          "cost": 2.2144,
                           "chosen": true
                         }
                       ] /* considered_access_paths */
@@ -1517,7 +1518,7 @@ field4,field5,field6	{
                                           {
                                             "access_type": "scan",
                                             "rows": 3,
-                                            "cost": 2.0342,
+                                            "cost": 2.6342,
                                             "chosen": true
                                           }
                                         ] /* considered_access_paths */
@@ -1544,7 +1545,7 @@ field4,field5,field6	{
                                                 "access_type": "scan",
                                                 "using_join_cache": true,
                                                 "rows": 3,
-                                                "cost": 2.0344,
+                                                "cost": 3.8344,
                                                 "chosen": true
                                               }
                                             ] /* considered_access_paths */
@@ -1571,7 +1572,7 @@ field4,field5,field6	{
                                           {
                                             "access_type": "scan",
                                             "rows": 3,
-                                            "cost": 2.0342,
+                                            "cost": 2.6342,
                                             "chosen": true
                                           }
                                         ] /* considered_access_paths */
@@ -1920,6 +1921,7 @@ table2.`col_int_nokey` <> any ( select 5
                         "rows": 2,
                         "cost": 4.41,
                         "rowid_ordered": false,
+                        "using_mrr": false,
                         "chosen": true
                       }
                     ] /* range_scan_alternatives */,
@@ -1970,7 +1972,7 @@ table2.`col_int_nokey` <> any ( select 5
                     {
                       "access_type": "range",
                       "rows": 2,
-                      "cost": 4.41,
+                      "cost": 4.81,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -1996,7 +1998,7 @@ table2.`col_int_nokey` <> any ( select 5
                           "access_type": "scan",
                           "using_join_cache": true,
                           "rows": 2,
-                          "cost": 2.0227,
+                          "cost": 2.8227,
                           "chosen": false
                         }
                       ] /* considered_access_paths */
@@ -2075,7 +2077,7 @@ table2.`col_int_nokey` <> any ( select 5
                                           {
                                             "access_type": "scan",
                                             "rows": 2,
-                                            "cost": 2.0225,
+                                            "cost": 2.4225,
                                             "chosen": true
                                           }
                                         ] /* considered_access_paths */

=== modified file 'mysql-test/suite/opt_trace/r/temp_table.result'
--- a/mysql-test/suite/opt_trace/r/temp_table.result	2012-03-28 13:39:57 +0000
+++ b/mysql-test/suite/opt_trace/r/temp_table.result	2012-06-05 07:13:40 +0000
@@ -68,7 +68,7 @@ SELECT uniq, col1 FROM t1 GROUP BY col2,
                     {
                       "access_type": "scan",
                       "rows": 8,
-                      "cost": 2.0391,
+                      "cost": 3.6391,
                       "chosen": true
                     }
                   ] /* considered_access_paths */
@@ -231,7 +231,7 @@ SELECT uniq, col1, col2 FROM t1 GROUP BY
                     {
                       "access_type": "scan",
                       "rows": 8,
-                      "cost": 2.0391,
+                      "cost": 3.6391,
                       "chosen": true,
                       "use_tmp_table": true
                     }
@@ -400,7 +400,7 @@ SELECT uniq, col1, col2 FROM t1 GROUP BY
                     {
                       "access_type": "scan",
                       "rows": 16,
-                      "cost": 2.0781,
+                      "cost": 5.2781,
                       "chosen": true,
                       "use_tmp_table": true
                     }
@@ -573,7 +573,7 @@ SELECT pool_id FROM information_schema.i
                     {
                       "access_type": "scan",
                       "rows": 2,
-                      "cost": 10.1,
+                      "cost": 10.5,
                       "chosen": true
                     }
                   ] /* considered_access_paths */

=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc	2012-05-31 16:21:37 +0000
+++ b/sql/opt_range.cc	2012-06-05 07:13:40 +0000
@@ -5551,6 +5551,8 @@ static TRP_RANGE *get_key_scans_params(P
       else
         trace_idx.add("rowid_ordered", false);
 
+      trace_idx.add("using_mrr", !(mrr_flags & HA_MRR_USE_DEFAULT_IMPL));
+
       if (found_records != HA_POS_ERROR &&
           read_time > (found_read_time= cost.total_cost()))
       {

=== modified file 'sql/sql_planner.cc'
--- a/sql/sql_planner.cc	2012-05-31 14:28:35 +0000
+++ b/sql/sql_planner.cc	2012-06-05 07:13:40 +0000
@@ -862,8 +862,8 @@ void Optimize_table_order::best_access_p
   if (!(records >= s->found_records || best > s->read_time))            // (1)
   {
     // "scan" means (full) index scan or (full) table scan.
-    trace_access_scan.add_alnum("access_type", s->quick ? "range" : "scan");
-    trace_access_scan.add("cost", s->read_time).
+    trace_access_scan.add_alnum("access_type", s->quick ? "range" : "scan").
+      add("cost", s->read_time + s->found_records * ROW_EVALUATE_COST).
       add("rows", s->found_records).
       add_alnum("cause", "cost");
 
@@ -982,16 +982,18 @@ void Optimize_table_order::best_access_p
       }
     }
 
+    const double scan_cost=
+      tmp + (record_count * ROW_EVALUATE_COST * rnd_records);
+
     trace_access_scan.add("rows", rows2double(rnd_records)).
-      add("cost", tmp);
+      add("cost", scan_cost);
     /*
       We estimate the cost of evaluating WHERE clause for found records
       as record_count * rnd_records * ROW_EVALUATE_COST. This cost plus
       tmp give us total cost of using TABLE SCAN
     */
     if (best == DBL_MAX ||
-        (tmp  + (record_count * ROW_EVALUATE_COST * rnd_records) <
-         best + (record_count * ROW_EVALUATE_COST * records)))
+        (scan_cost < best + (record_count * ROW_EVALUATE_COST * records)))
     {
       /*
         If the table has a range (s->quick is set) make_join_select()

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (jorgen.loland:3948 to 3949) Jorgen Loland5 Jun