summaryrefslogtreecommitdiff
path: root/sql/filesort.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-04-07 19:24:14 +0300
committerunknown <monty@mysql.com>2005-04-07 19:24:14 +0300
commite10d81448ddc949b66ca85459b6f22bf1eda27fe (patch)
treea13c6e5a064f49577a196e35cf5333975a36f347 /sql/filesort.cc
parent99c0dd3bc6f55be3e144129025a87a26c9470957 (diff)
downloadmariadb-git-e10d81448ddc949b66ca85459b6f22bf1eda27fe.tar.gz
Moved some old test and added a new test to only be run with mysql-test-run --big
Fixed warnings by valgrind for sum_distinct.test Enable buffered-record-reads after filesort for InnoDB tables with short primary key Enabled sort-with-data for MyISAM temporary files BitKeeper/etc/ignore: added tools/mysqltestmanager client/mysqltest.c: Ensure that BIG_TEST is always set to 0 or 1 Fix the 'eval' also honors 'require' mysql-test/mysql-test-run.sh: Enlarge InnoDB table space for --big tests mysql-test/r/heap.result: Fix after adding more optimzation for filsort mysql-test/r/sum_distinct.result: Move 'slow' part of test to sum_distinct-big.test mysql-test/t/heap.test: Ensure that results are indpendent of optimizer mysql-test/t/sum_distinct.test: Move 'slow' part of test to sum_distinct-big.test sql/filesort.cc: Use 'sort with data' also on temporary files and with INSERT ... SELECT sql/ha_innodb.h: Remove HA_FAST_KEY_READ to enable buffered-record-reads after filesort sql/handler.h: More comments sql/mysql_priv.h: A bit smaller limit for cache for buffered-records-read (after testing) sql/records.cc: Don't use buffered-record-reads if ref_length > MAX_REFLENGTH Fixed warning from valgrind in 'sum_distinct' sql/sql_select.cc: Ensure that tempory tables has query_id set for all fields (Required for sort-with-data to work on temp files)
Diffstat (limited to 'sql/filesort.cc')
-rw-r--r--sql/filesort.cc33
1 files changed, 18 insertions, 15 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc
index c50f1daa6ef..30ebd8d59e1 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -127,7 +127,8 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
param.ref_length= table->file->ref_length;
param.addon_field= 0;
param.addon_length= 0;
- if (!(table->s->tmp_table || table->fulltext_searched))
+ if (!(table->file->table_flags() & HA_FAST_KEY_READ) &&
+ !table->fulltext_searched)
{
/*
Get the descriptors of all fields whose values are appended
@@ -1301,27 +1302,29 @@ get_addon_fields(THD *thd, Field **ptabfield, uint sortlength, uint *plength)
uint length= 0;
uint fields= 0;
uint null_fields= 0;
-
- /*
- If there is a reference to a field in the query add it
- to the the set of appended fields.
- Note for future refinement:
- This this a too strong condition.
- Actually we need only the fields referred in the
- result set. And for some of them it makes sense to use
- the values directly from sorted fields.
+ query_id_t query_id= thd->query_id;
+ /*
+ If there is a reference to a field in the query add it
+ to the the set of appended fields.
+ Note for future refinement:
+ This this a too strong condition.
+ Actually we need only the fields referred in the
+ result set. And for some of them it makes sense to use
+ the values directly from sorted fields.
*/
*plength= 0;
+
/*
- The following statement is added to avoid sorting in alter_table.
- The fact is the filter 'field->query_id != thd->query_id'
- doesn't work for alter table
+ The following statement is added to avoid sorting in alter_table.
+ The fact is the filter 'field->query_id != thd->query_id'
+ doesn't work for alter table
*/
- if (thd->lex->sql_command != SQLCOM_SELECT)
+ if (thd->lex->sql_command != SQLCOM_SELECT &&
+ thd->lex->sql_command != SQLCOM_INSERT_SELECT)
return 0;
for (pfield= ptabfield; (field= *pfield) ; pfield++)
{
- if (field->query_id != thd->query_id)
+ if (field->query_id != query_id)
continue;
if (field->flags & BLOB_FLAG)
return 0;