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
5105fd1c
Commit
5105fd1c
authored
Oct 09, 2009
by
Mattias Jonsson
Browse files
Options
Browse Files
Download
Plain Diff
merge into mysql-5.1-bugteam
parents
5f8cfacf
27b80f9d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
7 deletions
+55
-7
mysql-test/r/partition.result
mysql-test/r/partition.result
+15
-0
mysql-test/t/partition.test
mysql-test/t/partition.test
+13
-0
sql/ha_partition.cc
sql/ha_partition.cc
+27
-7
No files found.
mysql-test/r/partition.result
View file @
5105fd1c
...
...
@@ -50,6 +50,21 @@ t1 CREATE TABLE `t1` (
PARTITION p3 VALUES LESS THAN (733969) ENGINE = MyISAM,
PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
DROP TABLE t1;
create table t1 (a int, b int, key(a))
partition by list (a)
( partition p0 values in (1),
partition p1 values in (2));
insert into t1 values (1,1),(2,1),(2,2),(2,3);
show indexes from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 a 1 a A NULL NULL NULL YES BTREE
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
show indexes from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 a 1 a A 1 NULL NULL YES BTREE
drop table t1;
CREATE TABLE t1 (a INT, FOREIGN KEY (a) REFERENCES t0 (a))
ENGINE=MyISAM
PARTITION BY HASH (a);
...
...
mysql-test/t/partition.test
View file @
5105fd1c
...
...
@@ -61,6 +61,19 @@ SELECT * FROM t1;
SHOW
CREATE
TABLE
t1
;
DROP
TABLE
t1
;
#
# Bug#44059: rec_per_key on empty partition gives weird optimiser results
#
create
table
t1
(
a
int
,
b
int
,
key
(
a
))
partition
by
list
(
a
)
(
partition
p0
values
in
(
1
),
partition
p1
values
in
(
2
));
insert
into
t1
values
(
1
,
1
),(
2
,
1
),(
2
,
2
),(
2
,
3
);
show
indexes
from
t1
;
analyze
table
t1
;
show
indexes
from
t1
;
drop
table
t1
;
#
# Bug#36001: Partitions: spelling and using some error messages
#
...
...
sql/ha_partition.cc
View file @
5105fd1c
...
...
@@ -5011,8 +5011,9 @@ int ha_partition::info(uint flag)
If the handler doesn't support statistics, it should set all of the
above to 0.
We will allow the first handler to set the rec_per_key and use
this as an estimate on the total table.
We first scans through all partitions to get the one holding most rows.
We will then allow the handler with the most rows to set
the rec_per_key and use this as an estimate on the total table.
max_data_file_length: Maximum data file length
We ignore it, is only used in
...
...
@@ -5024,14 +5025,33 @@ int ha_partition::info(uint flag)
ref_length: We set this to the value calculated
and stored in local object
create_time: Creation time of table
Set by first handler
So we calculate these constants by using the variables
on the first
handler.
So we calculate these constants by using the variables
from the
handler
with most rows
.
*/
handler
*
file
;
handler
*
file
,
**
file_array
;
ulonglong
max_records
=
0
;
uint32
i
=
0
;
uint32
handler_instance
=
0
;
file_array
=
m_file
;
do
{
file
=
*
file_array
;
/* Get variables if not already done */
if
(
!
(
flag
&
HA_STATUS_VARIABLE
)
||
!
bitmap_is_set
(
&
(
m_part_info
->
used_partitions
),
(
file_array
-
m_file
)))
file
->
info
(
HA_STATUS_VARIABLE
);
if
(
file
->
stats
.
records
>
max_records
)
{
max_records
=
file
->
stats
.
records
;
handler_instance
=
i
;
}
i
++
;
}
while
(
*
(
++
file_array
));
file
=
m_file
[
0
];
file
=
m_file
[
handler_instance
];
file
->
info
(
HA_STATUS_CONST
);
stats
.
create_time
=
file
->
stats
.
create_time
;
ref_length
=
m_ref_length
;
...
...
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