Removed wrong patch to fix DATE BETWEEN TIMESTAMP1 AND TIMESTAMP2
Some simple optimizations
This commit is contained in:
parent
aceaf381ef
commit
5333cfb429
@ -23510,17 +23510,21 @@ will be logged in the execution order.
|
|||||||
Updates to non-transactional tables are stored in the binary log
|
Updates to non-transactional tables are stored in the binary log
|
||||||
immediately after execution. For transactional tables such as @code{BDB}
|
immediately after execution. For transactional tables such as @code{BDB}
|
||||||
or @code{InnoDB} tables, all updates (@code{UPDATE}, @code{DELETE}
|
or @code{InnoDB} tables, all updates (@code{UPDATE}, @code{DELETE}
|
||||||
or @code{INSERT}) that change tables are cached until a @code{COMMIT}.
|
or @code{INSERT}) that change tables are cached until a @code{COMMIT} command
|
||||||
|
is sent to the server. At this point mysqld writes the whole transaction to
|
||||||
|
the binary log before the @code{COMMIT} is executed.
|
||||||
Every thread will, on start, allocate a buffer of @code{binlog_cache_size}
|
Every thread will, on start, allocate a buffer of @code{binlog_cache_size}
|
||||||
to buffer queries. If a query is bigger than this, the thread will open
|
to buffer queries. If a query is bigger than this, the thread will open
|
||||||
a temporary file to handle the bigger cache. The temporary file will
|
a temporary file to store the transcation. The temporary file will
|
||||||
be deleted when the thread ends.
|
be deleted when the thread ends.
|
||||||
|
|
||||||
The @code{max_binlog_cache_size} can be used to restrict the total size used
|
The @code{max_binlog_cache_size} (default 4G) can be used to restrict
|
||||||
to cache a multi-query transaction.
|
the total size used to cache a multi-query transaction. If a transaction is
|
||||||
|
bigger than this it will fail and roll back.
|
||||||
|
|
||||||
If you are using the update or binary log, concurrent inserts will
|
If you are using the update or binary log, concurrent inserts will
|
||||||
not work together with @code{CREATE ... SELECT} and @code{INSERT ... SELECT}.
|
be converted to normal inserts when using @code{CREATE ... SELECT} and
|
||||||
|
@code{INSERT ... SELECT}.
|
||||||
This is to ensure that you can recreate an exact copy of your tables by
|
This is to ensure that you can recreate an exact copy of your tables by
|
||||||
applying the log on a backup.
|
applying the log on a backup.
|
||||||
|
|
||||||
|
@ -468,7 +468,7 @@ fi
|
|||||||
|
|
||||||
MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB \
|
MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB \
|
||||||
--user=$DBUSER --password=$DBPASSWD --silent -v --skip-safemalloc \
|
--user=$DBUSER --password=$DBPASSWD --silent -v --skip-safemalloc \
|
||||||
--tmpdir=$MYSQL_TMP_DIR"
|
--tmpdir=$MYSQL_TMP_DIR --port=$MASTER_MYPORT"
|
||||||
MYSQL_TEST_BIN=$MYSQL_TEST
|
MYSQL_TEST_BIN=$MYSQL_TEST
|
||||||
MYSQL_TEST="$MYSQL_TEST $MYSQL_TEST_ARGS"
|
MYSQL_TEST="$MYSQL_TEST $MYSQL_TEST_ARGS"
|
||||||
GDB_CLIENT_INIT=$MYSQL_TMP_DIR/gdbinit.client
|
GDB_CLIENT_INIT=$MYSQL_TMP_DIR/gdbinit.client
|
||||||
|
@ -46,20 +46,6 @@ select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
|
|||||||
select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL;
|
select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL;
|
||||||
1 XOR 1 1 XOR 0 0 XOR 1 0 XOR 0 NULL XOR 1 1 XOR NULL 0 XOR NULL
|
1 XOR 1 1 XOR 0 0 XOR 1 0 XOR 0 NULL XOR 1 1 XOR NULL 0 XOR NULL
|
||||||
0 1 1 0 NULL NULL NULL
|
0 1 1 0 NULL NULL NULL
|
||||||
drop table if exists t1,t2;
|
|
||||||
CREATE TABLE t1 ( start datetime default NULL) TYPE=MyISAM;
|
|
||||||
INSERT INTO t1 VALUES ('2002-10-21 00:00:00');
|
|
||||||
INSERT INTO t1 VALUES ('2002-10-28 00:00:00');
|
|
||||||
INSERT INTO t1 VALUES ('2002-11-04 00:00:00');
|
|
||||||
CREATE TABLE t2 ( ctime1 timestamp(14) NOT NULL, ctime2 timestamp(14) NOT NULL) TYPE=MyISAM;
|
|
||||||
INSERT INTO t2 VALUES (20021029165106,20021105164731);
|
|
||||||
select * from t1, t2 where t1.start between t2.ctime1 and t2.ctime2;
|
|
||||||
start ctime1 ctime2
|
|
||||||
2002-11-04 00:00:00 20021029165106 20021105164731
|
|
||||||
select * from t1, t2 where t1.start >= t2.ctime1 and t1.start <= t2.ctime2;
|
|
||||||
start ctime1 ctime2
|
|
||||||
2002-11-04 00:00:00 20021029165106 20021105164731
|
|
||||||
drop table if exists t1,t2;
|
|
||||||
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
|
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
|
||||||
5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
|
5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
|
||||||
0 1
|
0 1
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
drop table if exists t1,t2;
|
drop table if exists t1,t2,t3;
|
||||||
select from_days(to_days("960101")),to_days(960201)-to_days("19960101"),to_days(date_add(curdate(), interval 1 day))-to_days(curdate()),weekday("1997-11-29");
|
select from_days(to_days("960101")),to_days(960201)-to_days("19960101"),to_days(date_add(curdate(), interval 1 day))-to_days(curdate()),weekday("1997-11-29");
|
||||||
from_days(to_days("960101")) to_days(960201)-to_days("19960101") to_days(date_add(curdate(), interval 1 day))-to_days(curdate()) weekday("1997-11-29")
|
from_days(to_days("960101")) to_days(960201)-to_days("19960101") to_days(date_add(curdate(), interval 1 day))-to_days(curdate()) weekday("1997-11-29")
|
||||||
1996-01-01 31 1 5
|
1996-01-01 31 1 5
|
||||||
@ -372,3 +372,18 @@ select extract(MONTH FROM "0000-00-00"),extract(MONTH FROM d),extract(MONTH FROM
|
|||||||
extract(MONTH FROM "0000-00-00") extract(MONTH FROM d) extract(MONTH FROM dt) extract(MONTH FROM t) extract(MONTH FROM c)
|
extract(MONTH FROM "0000-00-00") extract(MONTH FROM d) extract(MONTH FROM dt) extract(MONTH FROM t) extract(MONTH FROM c)
|
||||||
0 0 0 0 0
|
0 0 0 0 0
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
CREATE TABLE t1 ( start datetime default NULL);
|
||||||
|
INSERT INTO t1 VALUES ('2002-10-21 00:00:00'),('2002-10-28 00:00:00'),('2002-11-04 00:00:00');
|
||||||
|
CREATE TABLE t2 ( ctime1 timestamp(14) NOT NULL, ctime2 timestamp(14) NOT NULL);
|
||||||
|
INSERT INTO t2 VALUES (20021029165106,20021105164731);
|
||||||
|
CREATE TABLE t3 (ctime1 char(19) NOT NULL, ctime2 char(19) NOT NULL);
|
||||||
|
INSERT INTO t3 VALUES ("2002-10-29 16:51:06","2002-11-05 16:47:31");
|
||||||
|
select * from t1, t2 where t1.start between t2.ctime1 and t2.ctime2;
|
||||||
|
start ctime1 ctime2
|
||||||
|
select * from t1, t2 where t1.start >= t2.ctime1 and t1.start <= t2.ctime2;
|
||||||
|
start ctime1 ctime2
|
||||||
|
2002-11-04 00:00:00 20021029165106 20021105164731
|
||||||
|
select * from t1, t3 where t1.start between t3.ctime1 and t3.ctime2;
|
||||||
|
start ctime1 ctime2
|
||||||
|
2002-11-04 00:00:00 2002-10-29 16:51:06 2002-11-05 16:47:31
|
||||||
|
drop table t1,t2,t3;
|
||||||
|
@ -17,16 +17,6 @@ select 2 in (3,2,5,9,5,1),"monty" in ("david","monty","allan"), 1.2 in (1.4,1.2,
|
|||||||
select -1.49 or -1.49,0.6 or 0.6;
|
select -1.49 or -1.49,0.6 or 0.6;
|
||||||
select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
|
select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
|
||||||
select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL;
|
select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL;
|
||||||
drop table if exists t1,t2;
|
|
||||||
CREATE TABLE t1 ( start datetime default NULL) TYPE=MyISAM;
|
|
||||||
INSERT INTO t1 VALUES ('2002-10-21 00:00:00');
|
|
||||||
INSERT INTO t1 VALUES ('2002-10-28 00:00:00');
|
|
||||||
INSERT INTO t1 VALUES ('2002-11-04 00:00:00');
|
|
||||||
CREATE TABLE t2 ( ctime1 timestamp(14) NOT NULL, ctime2 timestamp(14) NOT NULL) TYPE=MyISAM;
|
|
||||||
INSERT INTO t2 VALUES (20021029165106,20021105164731);
|
|
||||||
select * from t1, t2 where t1.start between t2.ctime1 and t2.ctime2;
|
|
||||||
select * from t1, t2 where t1.start >= t2.ctime1 and t1.start <= t2.ctime2;
|
|
||||||
drop table if exists t1,t2;
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Wrong usage of functions
|
# Wrong usage of functions
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# time functions
|
# time functions
|
||||||
#
|
#
|
||||||
drop table if exists t1,t2;
|
drop table if exists t1,t2,t3;
|
||||||
|
|
||||||
select from_days(to_days("960101")),to_days(960201)-to_days("19960101"),to_days(date_add(curdate(), interval 1 day))-to_days(curdate()),weekday("1997-11-29");
|
select from_days(to_days("960101")),to_days(960201)-to_days("19960101"),to_days(date_add(curdate(), interval 1 day))-to_days(curdate()),weekday("1997-11-29");
|
||||||
select period_add("9602",-12),period_diff(199505,"9404") ;
|
select period_add("9602",-12),period_diff(199505,"9404") ;
|
||||||
@ -160,3 +160,20 @@ select yearweek("0000-00-00"),yearweek(d),yearweek(dt),yearweek(t),yearweek(c) f
|
|||||||
select to_days("0000-00-00"),to_days(d),to_days(dt),to_days(t),to_days(c) from t1;
|
select to_days("0000-00-00"),to_days(d),to_days(dt),to_days(t),to_days(c) from t1;
|
||||||
select extract(MONTH FROM "0000-00-00"),extract(MONTH FROM d),extract(MONTH FROM dt),extract(MONTH FROM t),extract(MONTH FROM c) from t1;
|
select extract(MONTH FROM "0000-00-00"),extract(MONTH FROM d),extract(MONTH FROM dt),extract(MONTH FROM t),extract(MONTH FROM c) from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test problem with TIMESTAMP and BETWEEN
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 ( start datetime default NULL);
|
||||||
|
INSERT INTO t1 VALUES ('2002-10-21 00:00:00'),('2002-10-28 00:00:00'),('2002-11-04 00:00:00');
|
||||||
|
CREATE TABLE t2 ( ctime1 timestamp(14) NOT NULL, ctime2 timestamp(14) NOT NULL);
|
||||||
|
INSERT INTO t2 VALUES (20021029165106,20021105164731);
|
||||||
|
CREATE TABLE t3 (ctime1 char(19) NOT NULL, ctime2 char(19) NOT NULL);
|
||||||
|
INSERT INTO t3 VALUES ("2002-10-29 16:51:06","2002-11-05 16:47:31");
|
||||||
|
|
||||||
|
# The following statement should be fixed to return a row in 4.1
|
||||||
|
select * from t1, t2 where t1.start between t2.ctime1 and t2.ctime2;
|
||||||
|
select * from t1, t2 where t1.start >= t2.ctime1 and t1.start <= t2.ctime2;
|
||||||
|
select * from t1, t3 where t1.start between t3.ctime1 and t3.ctime2;
|
||||||
|
drop table t1,t2,t3;
|
||||||
|
@ -544,7 +544,6 @@ public:
|
|||||||
enum Item_result result_type () const { return field_length == 8 || field_length == 14 ? INT_RESULT : STRING_RESULT; }
|
enum Item_result result_type () const { return field_length == 8 || field_length == 14 ? INT_RESULT : STRING_RESULT; }
|
||||||
enum_field_types type() const { return FIELD_TYPE_TIMESTAMP;}
|
enum_field_types type() const { return FIELD_TYPE_TIMESTAMP;}
|
||||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
|
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
|
||||||
enum Item_result cmp_type () const { return INT_RESULT; }
|
|
||||||
void store(const char *to,uint length);
|
void store(const char *to,uint length);
|
||||||
void store(double nr);
|
void store(double nr);
|
||||||
void store(longlong nr);
|
void store(longlong nr);
|
||||||
|
@ -360,7 +360,6 @@ void Item_func_between::fix_length_and_dec()
|
|||||||
if (args[0]->type() == FIELD_ITEM)
|
if (args[0]->type() == FIELD_ITEM)
|
||||||
{
|
{
|
||||||
Field *field=((Item_field*) args[0])->field;
|
Field *field=((Item_field*) args[0])->field;
|
||||||
cmp_type=field->cmp_type();
|
|
||||||
if (field->store_for_compare())
|
if (field->store_for_compare())
|
||||||
{
|
{
|
||||||
if (convert_constant_item(field,&args[1]))
|
if (convert_constant_item(field,&args[1]))
|
||||||
|
@ -74,7 +74,7 @@ extern HASH open_cache;
|
|||||||
|
|
||||||
static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table,uint count,
|
static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table,uint count,
|
||||||
bool unlock, TABLE **write_locked);
|
bool unlock, TABLE **write_locked);
|
||||||
static int lock_external(TABLE **table,uint count);
|
static int lock_external(THD *thd, TABLE **table,uint count);
|
||||||
static int unlock_external(THD *thd, TABLE **table,uint count);
|
static int unlock_external(THD *thd, TABLE **table,uint count);
|
||||||
static void print_lock_error(int error);
|
static void print_lock_error(int error);
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd,TABLE **tables,uint count)
|
|||||||
}
|
}
|
||||||
|
|
||||||
thd->proc_info="System lock";
|
thd->proc_info="System lock";
|
||||||
if (lock_external(tables,count))
|
if (lock_external(thd, tables, count))
|
||||||
{
|
{
|
||||||
my_free((gptr) sql_lock,MYF(0));
|
my_free((gptr) sql_lock,MYF(0));
|
||||||
sql_lock=0;
|
sql_lock=0;
|
||||||
@ -159,11 +159,10 @@ retry:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int lock_external(TABLE **tables,uint count)
|
static int lock_external(THD *thd, TABLE **tables, uint count)
|
||||||
{
|
{
|
||||||
reg1 uint i;
|
reg1 uint i;
|
||||||
int lock_type,error;
|
int lock_type,error;
|
||||||
THD *thd=current_thd;
|
|
||||||
DBUG_ENTER("lock_external");
|
DBUG_ENTER("lock_external");
|
||||||
|
|
||||||
for (i=1 ; i <= count ; i++, tables++)
|
for (i=1 ; i <= count ; i++, tables++)
|
||||||
|
@ -502,7 +502,9 @@ struct show_var_st init_vars[]= {
|
|||||||
{"skip_networking", (char*) &opt_disable_networking, SHOW_BOOL},
|
{"skip_networking", (char*) &opt_disable_networking, SHOW_BOOL},
|
||||||
{"skip_show_database", (char*) &opt_skip_show_db, SHOW_BOOL},
|
{"skip_show_database", (char*) &opt_skip_show_db, SHOW_BOOL},
|
||||||
{sys_slow_launch_time.name, (char*) &sys_slow_launch_time, SHOW_SYS},
|
{sys_slow_launch_time.name, (char*) &sys_slow_launch_time, SHOW_SYS},
|
||||||
|
#ifdef HAVE_SYS_UN_H
|
||||||
{"socket", (char*) &mysql_unix_port, SHOW_CHAR_PTR},
|
{"socket", (char*) &mysql_unix_port, SHOW_CHAR_PTR},
|
||||||
|
#endif
|
||||||
{sys_sort_buffer.name, (char*) &sys_sort_buffer, SHOW_SYS},
|
{sys_sort_buffer.name, (char*) &sys_sort_buffer, SHOW_SYS},
|
||||||
{"sql_mode", (char*) &opt_sql_mode, SHOW_LONG},
|
{"sql_mode", (char*) &opt_sql_mode, SHOW_LONG},
|
||||||
{"table_cache", (char*) &table_cache_size, SHOW_LONG},
|
{"table_cache", (char*) &table_cache_size, SHOW_LONG},
|
||||||
|
@ -1275,7 +1275,7 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db,
|
|||||||
int error;
|
int error;
|
||||||
DBUG_ENTER("open_unireg_entry");
|
DBUG_ENTER("open_unireg_entry");
|
||||||
|
|
||||||
(void) sprintf(path,"%s/%s/%s",mysql_data_home,db,name);
|
strxmov(path, mysql_data_home, "/", db, "/", name, NullS);
|
||||||
if (openfrm(path,alias,
|
if (openfrm(path,alias,
|
||||||
(uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE | HA_GET_INDEX |
|
(uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE | HA_GET_INDEX |
|
||||||
HA_TRY_READ_ONLY),
|
HA_TRY_READ_ONLY),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user