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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
f1ab6323
Commit
f1ab6323
authored
Jan 07, 2009
by
Mattias Jonsson
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
eb3daa6d
7ac77265
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
2 deletions
+30
-2
mysql-test/r/partition_pruning.result
mysql-test/r/partition_pruning.result
+12
-0
mysql-test/t/partition_pruning.test
mysql-test/t/partition_pruning.test
+16
-0
sql/sql_partition.cc
sql/sql_partition.cc
+2
-2
No files found.
mysql-test/r/partition_pruning.result
View file @
f1ab6323
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
CREATE TABLE t1
(a INT NOT NULL AUTO_INCREMENT,
b DATETIME,
PRIMARY KEY (a,b),
KEY (b))
PARTITION BY RANGE (to_days(b))
(PARTITION p0 VALUES LESS THAN (733681) COMMENT = 'LESS THAN 2008-10-01',
PARTITION p1 VALUES LESS THAN (733712) COMMENT = 'LESS THAN 2008-11-01',
PARTITION pX VALUES LESS THAN MAXVALUE);
SELECT a,b FROM t1 WHERE b >= '2008-12-01' AND b < '2009-12-00';
a b
DROP TABLE t1;
create table t1 ( a int not null) partition by hash(a) partitions 2;
insert into t1 values (1),(2),(3);
explain select * from t1 where a=5 and a=6;
...
...
mysql-test/t/partition_pruning.test
View file @
f1ab6323
...
...
@@ -8,6 +8,22 @@
drop
table
if
exists
t1
,
t2
,
t3
,
t4
,
t5
,
t6
,
t7
,
t8
,
t9
;
--
enable_warnings
#
# Bug#40972: some sql execution lead the whole database crashing
#
# Setup so the start is at partition pX and end is at p1
# Pruning does handle 'bad' dates differently.
CREATE
TABLE
t1
(
a
INT
NOT
NULL
AUTO_INCREMENT
,
b
DATETIME
,
PRIMARY
KEY
(
a
,
b
),
KEY
(
b
))
PARTITION
BY
RANGE
(
to_days
(
b
))
(
PARTITION
p0
VALUES
LESS
THAN
(
733681
)
COMMENT
=
'LESS THAN 2008-10-01'
,
PARTITION
p1
VALUES
LESS
THAN
(
733712
)
COMMENT
=
'LESS THAN 2008-11-01'
,
PARTITION
pX
VALUES
LESS
THAN
MAXVALUE
);
SELECT
a
,
b
FROM
t1
WHERE
b
>=
'2008-12-01'
AND
b
<
'2009-12-00'
;
DROP
TABLE
t1
;
# Check if we can infer from condition on partition fields that
# no records will match.
...
...
sql/sql_partition.cc
View file @
f1ab6323
...
...
@@ -6760,7 +6760,7 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info,
store_key_image_to_rec
(
field
,
max_value
,
field_len
);
bool
include_endp
=
!
test
(
flags
&
NEAR_MAX
);
part_iter
->
part_nums
.
end
=
get_endpoint
(
part_info
,
0
,
include_endp
);
if
(
part_iter
->
part_nums
.
start
=
=
part_iter
->
part_nums
.
end
&&
if
(
part_iter
->
part_nums
.
start
>
=
part_iter
->
part_nums
.
end
&&
!
part_iter
->
ret_null_part
)
return
0
;
/* No partitions */
}
...
...
@@ -6938,7 +6938,7 @@ int get_part_iter_for_interval_via_walking(partition_info *part_info,
uint32
get_next_partition_id_range
(
PARTITION_ITERATOR
*
part_iter
)
{
if
(
part_iter
->
part_nums
.
cur
=
=
part_iter
->
part_nums
.
end
)
if
(
part_iter
->
part_nums
.
cur
>
=
part_iter
->
part_nums
.
end
)
{
part_iter
->
part_nums
.
cur
=
part_iter
->
part_nums
.
start
;
return
NOT_A_PARTITION_ID
;
...
...
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