summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <sergefp@mysql.com>2005-10-18 14:04:14 +0400
committerunknown <sergefp@mysql.com>2005-10-18 14:04:14 +0400
commit8ff8fac53dc7423d1fbe229dfb2f112236b7cf2a (patch)
treeb67aef0810c2a280d19c1888ea8171c81fdbedf3
parent1fe423aebaaefdae815662ce555703eb66b3f9e0 (diff)
downloadmariadb-git-8ff8fac53dc7423d1fbe229dfb2f112236b7cf2a.tar.gz
BUG#12915: post-review fixes
-rw-r--r--sql/opt_range.cc12
-rw-r--r--sql/records.cc19
2 files changed, 18 insertions, 13 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 29994c14d3e..71f937f90c6 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -584,8 +584,7 @@ SEL_ARG *SEL_ARG::clone_tree()
/*
- Find an index that allows to retrieve first #limit records in the given
- order cheaper then one would retrieve them using full table scan.
+ Find the best index to retrieve first N records in given order
SYNOPSIS
get_index_for_order()
@@ -594,10 +593,13 @@ SEL_ARG *SEL_ARG::clone_tree()
limit Number of records that will be retrieved
DESCRIPTION
+ Find the best index that allows to retrieve first #limit records in the
+ given order cheaper then one would retrieve them using full table scan.
+
+ IMPLEMENTATION
Run through all table indexes and find the shortest index that allows
- records to be retrieved in given order. If there is such index and
- reading first #limit records from it is cheaper then scanning the entire
- table, return it.
+ records to be retrieved in given order. We look for the shortest index
+ as we will have fewer index pages to read with it.
This function is used only by UPDATE/DELETE, so we take into account how
the UPDATE/DELETE code will work:
diff --git a/sql/records.cc b/sql/records.cc
index 1bf585ae46a..9150024d4b8 100644
--- a/sql/records.cc
+++ b/sql/records.cc
@@ -235,13 +235,16 @@ static int rr_quick(READ_RECORD *info)
/*
- Read next index record. The calling convention of this function is
- compatible with READ_RECORD::read_record.
+ A READ_RECORD::read_record implementation that reads index sequentially
SYNOPSIS
rr_index()
info Scan info
-
+
+ DESCRIPTION
+ Read the next index record (in forward direction) and translate return
+ value.
+
RETURN
0 Ok
-1 End of records
@@ -271,13 +274,13 @@ static int rr_index(READ_RECORD *info)
if (tmp != HA_ERR_RECORD_DELETED)
{
if (tmp == HA_ERR_END_OF_FILE)
- tmp= -1;
+ tmp= -1;
else
{
- if (info->print_error)
- info->table->file->print_error(tmp,MYF(0));
- if (tmp < 0) // Fix negative BDB errno
- tmp=1;
+ if (info->print_error)
+ info->table->file->print_error(tmp,MYF(0));
+ if (tmp < 0) // Fix negative BDB errno
+ tmp=1;
}
break;
}