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
5584e61f
Commit
5584e61f
authored
Mar 14, 2012
by
Mattias Jonsson
Browse files
Options
Browse Files
Download
Plain Diff
merge of bug#1364811 into mysql-5.5
parents
a930e474
58b21478
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
284 additions
and
143 deletions
+284
-143
mysql-test/r/partition_innodb.result
mysql-test/r/partition_innodb.result
+29
-0
mysql-test/r/partition_pruning.result
mysql-test/r/partition_pruning.result
+43
-43
mysql-test/t/partition_innodb.test
mysql-test/t/partition_innodb.test
+29
-0
sql/ha_partition.cc
sql/ha_partition.cc
+174
-91
sql/ha_partition.h
sql/ha_partition.h
+9
-9
No files found.
mysql-test/r/partition_innodb.result
View file @
5584e61f
drop table if exists t1, t2;
#
# Bug#13694811: THE OPTIMIZER WRONGLY USES THE FIRST
# INNODB PARTITION STATISTICS
#
CREATE TABLE t1
(a INT,
b varchar(64),
PRIMARY KEY (a),
KEY (b))
ENGINE = InnoDB
PARTITION BY RANGE (a)
SUBPARTITION BY HASH (a) SUBPARTITIONS 10
(PARTITION pNeg VALUES LESS THAN (0),
PARTITION p0 VALUES LESS THAN (1000),
PARTITION pMAX VALUES LESS THAN MAXVALUE);
# Only one row in the first 10 subpartitions
INSERT INTO t1 VALUES (-1, 'Only negative pk value');
INSERT INTO t1 VALUES (0, 'Mod Zero'), (1, 'One'), (2, 'Two'), (3, 'Three'),
(10, 'Zero'), (11, 'Mod One'), (12, 'Mod Two'), (13, 'Mod Three'),
(20, '0'), (21, '1'), (22, '2'), (23, '3'),
(4, '4'), (5, '5'), (6, '6'), (7, '7'), (8, '8'), (9, '9');
INSERT INTO t1 SELECT a + 30, b FROM t1 WHERE a >= 0;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
EXPLAIN SELECT b FROM t1 WHERE b between 'L' and 'N' AND a > -100;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY,b b 67 NULL 18 Using where; Using index
DROP TABLE t1;
#
# Bug#56287: crash when using Partition datetime in sub in query
#
CREATE TABLE t1
...
...
mysql-test/r/partition_pruning.result
View file @
5584e61f
This diff is collapsed.
Click to expand it.
mysql-test/t/partition_innodb.test
View file @
5584e61f
...
...
@@ -8,6 +8,35 @@ drop table if exists t1, t2;
let
$MYSQLD_DATADIR
=
`SELECT @@datadir`
;
--
echo
#
--
echo
# Bug#13694811: THE OPTIMIZER WRONGLY USES THE FIRST
--
echo
# INNODB PARTITION STATISTICS
--
echo
#
CREATE
TABLE
t1
(
a
INT
,
b
varchar
(
64
),
PRIMARY
KEY
(
a
),
KEY
(
b
))
ENGINE
=
InnoDB
PARTITION
BY
RANGE
(
a
)
SUBPARTITION
BY
HASH
(
a
)
SUBPARTITIONS
10
(
PARTITION
pNeg
VALUES
LESS
THAN
(
0
),
PARTITION
p0
VALUES
LESS
THAN
(
1000
),
PARTITION
pMAX
VALUES
LESS
THAN
MAXVALUE
);
--
echo
# Only one row in the first 10 subpartitions
INSERT
INTO
t1
VALUES
(
-
1
,
'Only negative pk value'
);
INSERT
INTO
t1
VALUES
(
0
,
'Mod Zero'
),
(
1
,
'One'
),
(
2
,
'Two'
),
(
3
,
'Three'
),
(
10
,
'Zero'
),
(
11
,
'Mod One'
),
(
12
,
'Mod Two'
),
(
13
,
'Mod Three'
),
(
20
,
'0'
),
(
21
,
'1'
),
(
22
,
'2'
),
(
23
,
'3'
),
(
4
,
'4'
),
(
5
,
'5'
),
(
6
,
'6'
),
(
7
,
'7'
),
(
8
,
'8'
),
(
9
,
'9'
);
INSERT
INTO
t1
SELECT
a
+
30
,
b
FROM
t1
WHERE
a
>=
0
;
ANALYZE
TABLE
t1
;
EXPLAIN
SELECT
b
FROM
t1
WHERE
b
between
'L'
and
'N'
AND
a
>
-
100
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# Bug#56287: crash when using Partition datetime in sub in query
--
echo
#
...
...
sql/ha_partition.cc
View file @
5584e61f
This diff is collapsed.
Click to expand it.
sql/ha_partition.h
View file @
5584e61f
...
...
@@ -177,6 +177,12 @@ private:
ha_rows
m_bulk_inserted_rows
;
/** used for prediction of start_bulk_insert rows */
enum_monotonicity_info
m_part_func_monotonicity_info
;
/** Sorted array of partition ids in descending order of number of rows. */
uint32
*
m_part_ids_sorted_by_num_of_records
;
/* Compare function for my_qsort2, for reversed order. */
static
int
compare_number_of_records
(
ha_partition
*
me
,
const
uint32
*
a
,
const
uint32
*
b
);
public:
handler
*
clone
(
const
char
*
name
,
MEM_ROOT
*
mem_root
);
virtual
void
set_part_info
(
partition_info
*
part_info
)
...
...
@@ -584,15 +590,9 @@ public:
*/
private:
/*
Helper function to get the minimum number of partitions to use for
the optimizer hints/cost calls.
*/
void
partitions_optimizer_call_preparations
(
uint
*
num_used_parts
,
uint
*
check_min_num
,
uint
*
first
);
ha_rows
estimate_rows
(
bool
is_records_in_range
,
uint
inx
,
key_range
*
min_key
,
key_range
*
max_key
);
/* Helper functions for optimizer hints. */
ha_rows
min_rows_for_estimate
();
uint
get_biggest_used_partition
(
uint
*
part_index
);
public:
/*
...
...
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