summaryrefslogtreecommitdiff
path: root/sql/filesort.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/filesort.cc')
-rw-r--r--sql/filesort.cc10
1 files changed, 2 insertions, 8 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 12b9bb5aadc..776ec064365 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -188,7 +188,6 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
my_b_clear(&buffpek_pointers);
buffpek=0;
error= 1;
- *found_rows= HA_POS_ERROR;
param.init_for_filesort(sortlength(thd, sortorder, s_length,
&multi_byte_charset),
@@ -687,7 +686,7 @@ static ha_rows find_all_keys(Sort_param *param, SQL_SELECT *select,
ref_pos= ref_buff;
quick_select=select && select->quick;
record=0;
- *found_rows= pq ? 0 : HA_POS_ERROR; // don't count unless pq is used
+ *found_rows= 0;
flag= ((file->ha_table_flags() & HA_REC_NOT_IN_SEQ) || quick_select);
if (flag)
ref_pos= &file->ref[0];
@@ -807,14 +806,9 @@ static ha_rows find_all_keys(Sort_param *param, SQL_SELECT *select,
if (write_record)
{
+ (*found_rows)++;
if (pq)
{
- /*
- only count rows when pq is used - otherwise there might be
- other filters *after* the filesort, we don't know the final row
- count here
- */
- (*found_rows)++;
pq->push(ref_pos);
idx= pq->num_elements();
}