Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
646bf2d8
Commit
646bf2d8
authored
Feb 06, 2006
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WL#2985 "Partition pruning", "do pruning for UPDATE/DELETE": Post-merge fixes
parent
67f1a02a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
69 deletions
+58
-69
mysql-test/r/partition_pruning.result
mysql-test/r/partition_pruning.result
+45
-49
mysql-test/t/partition_pruning.test
mysql-test/t/partition_pruning.test
+7
-8
sql/sql_delete.cc
sql/sql_delete.cc
+4
-6
sql/sql_update.cc
sql/sql_update.cc
+2
-6
No files found.
mysql-test/r/partition_pruning.result
View file @
646bf2d8
...
...
@@ -304,21 +304,56 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
explain partitions select * from t1 where b > 1 and b < 3 and (a =1 or a =2);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p1_sp2,p2_sp2 system NULL NULL NULL NULL 1
DROP TABLE IF EXISTS `t1`;
drop table t1;
create table t1 (a int) partition by list(a) (
partition p0 values in (1,2),
partition p1 values in (3,4)
);
insert into t1 values (1),(1),(2),(2),(3),(4),(3),(4);
flush status;
update t1 set a=100 where a=5;
show status like 'Handler_read_rnd_next';
Variable_name Value
Handler_read_rnd_next 0
flush status;
update t1 set a=100 where a+1=5+1;
show status like 'Handler_read_rnd_next';
Variable_name Value
Handler_read_rnd_next 10
flush status;
delete from t1 where a=5;
show status like 'Handler_read_rnd_next';
Variable_name Value
Handler_read_rnd_next 0
flush status;
delete from t1 where a+1=5+1;
show status like 'Handler_read_rnd_next';
Variable_name Value
Handler_read_rnd_next 10
create table t2 like t1;
insert into t2 select * from t2;
flush status;
update t1,t2 set t1.a=1000, t2.a=1000 where t1.a=5 and t2.a=5;
show status like 'Handler_read_rnd_next';
Variable_name Value
Handler_read_rnd_next 0
flush status;
delete t1,t2 from t1, t2 where t1.a=5 and t2.a=5;
show status like 'Handler_read_rnd_next';
Variable_name Value
Handler_read_rnd_next 0
drop table t1,t2;
CREATE TABLE `t1` (
`a` int(11) default NULL
);
INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
DROP TABLE IF EXISTS `t2`;
Warnings:
Note 1051 Unknown table 't2'
CREATE TABLE `t2` (
`a` int(11) default NULL,
KEY `a` (`a`)
) ;
insert into t2 select A.a + 10*(B.a + 10* C.a) from t1 A, t1 B, t1 C ;
insert into t1 select a from t2;
DROP TABLE IF EXISTS `t2`
;
drop table t2
;
CREATE TABLE `t2` (
`a` int(11) default NULL,
`b` int(11) default NULL
...
...
@@ -367,23 +402,23 @@ flush status;
update t2 set a = 1002 where a = 1001;
show status like 'Handler_read_rnd_next';
Variable_name Value
Handler_read_rnd_next
1015
Handler_read_rnd_next
0
flush status;
update t2 set b = 6 where a = 600;
show status like 'Handler_read_rnd_next';
Variable_name Value
Handler_read_rnd_next
1015
Handler_read_rnd_next
201
flush status;
update t2 set b = 6 where a > 600 and a < 800;
show status like 'Handler_read_rnd_next';
Variable_name Value
Handler_read_rnd_next
1015
Handler_read_rnd_next
201
flush status;
delete from t2 where a > 600;
show status like 'Handler_read_rnd_next';
Variable_name Value
Handler_read_rnd_next
1015
DROP TABLE IF EXISTS `t2`
;
Handler_read_rnd_next
402
drop table t2
;
CREATE TABLE `t2` (
`a` int(11) default NULL,
`b` int(11) default NULL,
...
...
@@ -510,42 +545,3 @@ show status like 'Handler_read_next';
Variable_name Value
Handler_read_next 0
drop table t1, t2;
drop table t1;
create table t1 (a int) partition by list(a) (
partition p0 values in (1,2),
partition p1 values in (3,4)
);
insert into t1 values (1),(1),(2),(2),(3),(4),(3),(4);
flush status;
update t1 set a=100 where a=5;
show status like 'Handler_read_rnd_next';
Variable_name Value
Handler_read_rnd_next 0
flush status;
update t1 set a=100 where a+1=5+1;
show status like 'Handler_read_rnd_next';
Variable_name Value
Handler_read_rnd_next 10
flush status;
delete from t1 where a=5;
show status like 'Handler_read_rnd_next';
Variable_name Value
Handler_read_rnd_next 0
flush status;
delete from t1 where a+1=5+1;
show status like 'Handler_read_rnd_next';
Variable_name Value
Handler_read_rnd_next 10
create table t2 like t1;
insert into t2 select * from t2;
flush status;
update t1,t2 set t1.a=1000, t2.a=1000 where t1.a=5 and t2.a=5;
show status like 'Handler_read_rnd_next';
Variable_name Value
Handler_read_rnd_next 3
flush status;
delete t1,t2 from t1, t2 where t1.a=5 and t2.a=5;
show status like 'Handler_read_rnd_next';
Variable_name Value
Handler_read_rnd_next 3
drop table t1,t2;
mysql-test/t/partition_pruning.test
View file @
646bf2d8
...
...
@@ -316,25 +316,24 @@ delete t1,t2 from t1, t2 where t1.a=5 and t2.a=5;
show
status
like
'Handler_read_rnd_next'
;
drop
table
t1
,
t2
;
# WL# 2986
DROP
TABLE
IF
EXISTS
`t1`
;
#
# WL#2986 Tests (Checking if partition pruning results are used at query
# execution phase)
#
CREATE
TABLE
`t1`
(
`a`
int
(
11
)
default
NULL
);
INSERT
INTO
t1
VALUES
(
0
),(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
7
),(
8
),(
9
);
DROP
TABLE
IF
EXISTS
`t2`
;
CREATE
TABLE
`t2`
(
`a`
int
(
11
)
default
NULL
,
KEY
`a`
(
`a`
)
)
;
insert
into
t2
select
A
.
a
+
10
*
(
B
.
a
+
10
*
C
.
a
)
from
t1
A
,
t1
B
,
t1
C
;
insert
into
t1
select
a
from
t2
;
DROP
TABLE
IF
EXISTS
`t2`
;
drop
table
t2
;
CREATE
TABLE
`t2`
(
`a`
int
(
11
)
default
NULL
,
`b`
int
(
11
)
default
NULL
...
...
@@ -377,8 +376,7 @@ flush status;
delete
from
t2
where
a
>
600
;
show
status
like
'Handler_read_rnd_next'
;
DROP
TABLE
IF
EXISTS
`t2`
;
drop
table
t2
;
CREATE
TABLE
`t2`
(
`a`
int
(
11
)
default
NULL
,
`b`
int
(
11
)
default
NULL
,
...
...
@@ -448,5 +446,6 @@ show status like 'Handler_read_prev';
show
status
like
'Handler_read_next'
;
drop
table
t1
,
t2
;
# No tests for NULLs in RANGE(monotonic_expr()) - they depend on BUG#15447
# being fixed.
sql/sql_delete.cc
View file @
646bf2d8
...
...
@@ -52,7 +52,6 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
table_list
->
view_db
.
str
,
table_list
->
view_name
.
str
);
DBUG_RETURN
(
TRUE
);
}
table
->
file
->
info
(
HA_STATUS_VARIABLE
|
HA_STATUS_NO_LOCK
);
thd
->
proc_info
=
"init"
;
table
->
map
=
1
;
...
...
@@ -79,6 +78,8 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
!
(
specialflag
&
(
SPECIAL_NO_NEW_FUNC
|
SPECIAL_SAFE_MODE
))
&&
!
(
table
->
triggers
&&
table
->
triggers
->
has_delete_triggers
()))
{
/* Update the table->file->records number */
table
->
file
->
info
(
HA_STATUS_VARIABLE
|
HA_STATUS_NO_LOCK
);
ha_rows
const
maybe_deleted
=
table
->
file
->
records
;
/*
If all rows shall be deleted, we always log this statement-based
...
...
@@ -108,12 +109,9 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
send_ok
(
thd
);
// No matching records
DBUG_RETURN
(
0
);
}
/*
Update the table->records number (note: we probably could remove the
previous file->info() call)
*/
table
->
file
->
info
(
HA_STATUS_VARIABLE
|
HA_STATUS_NO_LOCK
);
#endif
/* Update the table->file->records number */
table
->
file
->
info
(
HA_STATUS_VARIABLE
|
HA_STATUS_NO_LOCK
);
table
->
used_keys
.
clear_all
();
table
->
quick_keys
.
clear_all
();
// Can't use 'only index'
...
...
sql/sql_update.cc
View file @
646bf2d8
...
...
@@ -168,7 +168,6 @@ int mysql_update(THD *thd,
thd
->
proc_info
=
"init"
;
table
=
table_list
->
table
;
table
->
file
->
info
(
HA_STATUS_VARIABLE
|
HA_STATUS_NO_LOCK
);
/* Calculate "table->used_keys" based on the WHERE */
table
->
used_keys
=
table
->
s
->
keys_in_use
;
...
...
@@ -252,12 +251,9 @@ int mysql_update(THD *thd,
send_ok
(
thd
);
// No matching records
DBUG_RETURN
(
0
);
}
/*
Update the table->records number (note: we probably could remove the
previous file->info() call)
*/
table
->
file
->
info
(
HA_STATUS_VARIABLE
|
HA_STATUS_NO_LOCK
);
#endif
/* Update the table->file->records number */
table
->
file
->
info
(
HA_STATUS_VARIABLE
|
HA_STATUS_NO_LOCK
);
select
=
make_select
(
table
,
0
,
0
,
conds
,
0
,
&
error
);
if
(
error
||
!
limit
||
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment