diff options
Diffstat (limited to 'sql/filesort.cc')
-rw-r--r-- | sql/filesort.cc | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc index 569e1d37e0c..76f744df720 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -166,8 +166,6 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, TABLE_LIST *tab= table->pos_in_table_list; Item_subselect *subselect= tab ? tab->containing_subselect() : 0; - *found_rows= HA_POS_ERROR; - MYSQL_FILESORT_START(table->s->db.str, table->s->table_name.str); DEBUG_SYNC(thd, "filesort_start"); @@ -190,6 +188,7 @@ 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), @@ -690,8 +689,7 @@ static ha_rows find_all_keys(Sort_param *param, SQL_SELECT *select, ref_pos= ref_buff; quick_select=select && select->quick; record=0; - if (pq) // don't count unless pq is used - *found_rows= 0; + *found_rows= 0; flag= ((file->ha_table_flags() & HA_REC_NOT_IN_SEQ) || quick_select); if (flag) ref_pos= &file->ref[0]; @@ -814,14 +812,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(); } |