diff options
author | unknown <monty@tik.mysql.fi> | 2001-05-23 02:40:46 +0300 |
---|---|---|
committer | unknown <monty@tik.mysql.fi> | 2001-05-23 02:40:46 +0300 |
commit | 4b799725034bd5f2d7cda76d8a5bcb3b42cb88f3 (patch) | |
tree | 22a09c551394dd62383433e28ef919ca86f669b7 /sql | |
parent | 8ec67661b4327060a12f9888a1179d5161e4b9c4 (diff) | |
download | mariadb-git-4b799725034bd5f2d7cda76d8a5bcb3b42cb88f3.tar.gz |
Don't write rows in MyISAM tables when using count(distinct)
Don't read MyISAM header when running without locking
include/myisam.h:
Don't read header when running without locking.
myisam/mi_locking.c:
Don't update changed flag for temporary files.
myisam/mi_open.c:
Don't read header when running without locking.
myisam/mi_static.c:
Don't read header when running without locking.
sql/item_sum.cc:
Don't write rows in MyISAM tables when using count(distinct)
sql/mysqld.cc:
Don't read MyISAM header when running without locking.
Remove -Sg option.
sql/sql_analyse.h:
Remove duplicate header.
sql/sql_select.cc:
Cleaned up prototypes.
Don't write rows to count(DISTINCT) MyISAM tables.
sql/sql_select.h:
Cleaned up prototypes.
sql/table.h:
A
BitKeeper/etc/logging_ok:
Logging to logging@openlogging.org accepted
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_sum.cc | 1 | ||||
-rw-r--r-- | sql/mysqld.cc | 25 | ||||
-rw-r--r-- | sql/sql_analyse.h | 2 | ||||
-rw-r--r-- | sql/sql_select.cc | 12 | ||||
-rw-r--r-- | sql/sql_select.h | 2 | ||||
-rw-r--r-- | sql/table.h | 2 |
6 files changed, 17 insertions, 27 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc index ad1918e01e3..089f4f56216 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -867,6 +867,7 @@ bool Item_sum_count_distinct::setup(THD *thd) 0, 0, current_lex->options | thd->options))) return 1; table->file->extra(HA_EXTRA_NO_ROWS); // Don't update rows + table->no_rows=1; if(table->db_type == DB_TYPE_HEAP) // no blobs, otherwise it would be // MyISAM diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 656f8df9695..a0d2fcc8b67 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3028,14 +3028,13 @@ static void usage(void) puts("\ -O, --set-variable var=option\n\ Give a variable an value. --help lists variables\n\ - -Sg, --skip-grant-tables\n\ - Start without grant tables. This gives all users\n\ - FULL ACCESS to all tables!\n\ --safe-mode Skip some optimize stages (for testing)\n\ --skip-concurrent-insert\n\ Don't use concurrent insert with MyISAM\n\ --skip-delay-key-write\n\ Ignore the delay_key_write option for all tables\n\ + --skip-grant-tables Start without grant tables. This gives all users\n\ + FULL ACCESS to all tables!\n\ --skip-host-cache Don't cache host names\n\ --skip-locking Don't use system locking. To use isamchk one has\n\ to shut down the server.\n\ @@ -3172,7 +3171,7 @@ static void set_options(void) #endif #if defined( HAVE_mit_thread ) || defined( __WIN__ ) || defined( HAVE_LINUXTHREADS ) - my_disable_locking = 1; + my_disable_locking=myisam_single_user= 1; #endif my_bind_addr = htonl( INADDR_ANY ); } @@ -3265,20 +3264,6 @@ static void get_options(int argc,char **argv) test_flags= optarg ? (uint) atoi(optarg) : 0; opt_endinfo=1; break; - case 'S': - if (!optarg) - opt_specialflag|= SPECIAL_NO_NEW_FUNC | SPECIAL_SAFE_MODE; - else if (!strcmp(optarg,"l")) - my_disable_locking=1; - else if (!strcmp(optarg,"g")) - opt_noacl=1; - else - { - fprintf(stderr,"%s: Unrecognized option: %s\n",my_progname,optarg); - use_help(); - exit(1); - } - break; case (int) OPT_BIG_TABLES: thd_startup_options|=OPTION_BIG_TABLES; break; @@ -3456,7 +3441,7 @@ static void get_options(int argc,char **argv) opt_noacl=1; break; case (int) OPT_SKIP_LOCK: - my_disable_locking=1; + my_disable_locking=myisam_single_user= 1; break; case (int) OPT_SKIP_HOST_CACHE: opt_specialflag|= SPECIAL_NO_HOST_CACHE; @@ -4022,7 +4007,7 @@ static int get_service_parameters() } else if ( lstrcmp(szKeyValueName, TEXT("KeyBufferSize")) == 0 ) { - SET_CHANGEABLE_VARVAL( "key_buffer" ); + SET_CHANGEABLE_VARVAL( "key_buffer_size" ); } else if ( lstrcmp(szKeyValueName, TEXT("LongQueryTime")) == 0 ) { diff --git a/sql/sql_analyse.h b/sql/sql_analyse.h index b5554314439..1d26b34dad9 100644 --- a/sql/sql_analyse.h +++ b/sql/sql_analyse.h @@ -21,8 +21,6 @@ #pragma interface /* gcc class implementation */ #endif -#include <my_tree.h> - #define DEC_IN_AVG 4 typedef struct st_number_info diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 9e6b0b40f29..fcfdd5cb547 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -69,7 +69,7 @@ static COND *remove_eq_conds(COND *cond,Item::cond_result *cond_value); static bool const_expression_in_where(COND *conds,Item *item, Item **comp_item); static bool open_tmp_table(TABLE *table); static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param, - uint options); + ulong options); static int do_select(JOIN *join,List<Item> *fields,TABLE *tmp_table, Procedure *proc); static int sub_select_cache(JOIN *join,JOIN_TAB *join_tab,bool end_of_records); @@ -3317,7 +3317,7 @@ Field *create_tmp_field(TABLE *table,Item *item, Item::Type type, TABLE * create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, ORDER *group, bool distinct, bool save_sum_fields, - bool allow_distinct_limit, uint select_options) + bool allow_distinct_limit, ulong select_options) { TABLE *table; uint i,field_count,reclength,null_count,null_pack_length, @@ -3759,7 +3759,7 @@ static bool open_tmp_table(TABLE *table) static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param, - uint options) + ulong options) { int error; MI_KEYDEF keydef; @@ -3926,6 +3926,12 @@ bool create_myisam_from_heap(TABLE *table, TMP_TABLE_PARAM *param, int error, goto err1; table->file->index_end(); table->file->rnd_init(); + if (table->no_rows) + { + new_table->file->extra(HA_EXTRA_NO_ROWS); + new_table->no_rows=1; + } + /* copy all old rows */ while (!table->file->rnd_next(new_table.record[1])) { diff --git a/sql/sql_select.h b/sql/sql_select.h index 87157b1465f..bb9bb374c76 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -181,7 +181,7 @@ void TEST_join(JOIN *join); bool store_val_in_field(Field *field,Item *val); TABLE *create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, ORDER *group, bool distinct, bool save_sum_fields, - bool allow_distinct_limit, uint select_options); + bool allow_distinct_limit, ulong select_options); void free_tmp_table(THD *thd, TABLE *entry); void count_field_types(TMP_TABLE_PARAM *param, List<Item> &fields, bool reset_with_sum_func); diff --git a/sql/table.h b/sql/table.h index 706c499d852..b25e2d82132 100644 --- a/sql/table.h +++ b/sql/table.h @@ -89,7 +89,7 @@ struct st_table { my_bool copy_blobs; /* copy_blobs when storing */ my_bool null_row; /* All columns are null */ my_bool maybe_null,outer_join; /* Used with OUTER JOIN */ - my_bool distinct,const_table; + my_bool distinct,const_table,no_rows; my_bool key_read; my_bool crypted; my_bool db_low_byte_first; /* Portable row format */ |