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
e4a0d75a
Commit
e4a0d75a
authored
Dec 04, 2016
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
import a test case from percona-server-5.6.34-79.1
parent
e99990c6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
115 additions
and
0 deletions
+115
-0
mysql-test/extra/table_index_statistics.inc
mysql-test/extra/table_index_statistics.inc
+59
-0
mysql-test/suite/innodb/r/table_index_statistics.result
mysql-test/suite/innodb/r/table_index_statistics.result
+48
-0
mysql-test/suite/innodb/t/table_index_statistics.test
mysql-test/suite/innodb/t/table_index_statistics.test
+8
-0
No files found.
mysql-test/extra/table_index_statistics.inc
0 → 100644
View file @
e4a0d75a
# include file to test index and table statstics for specific storage engine
# requires includer set the default strorage engine for the session
# Bug 602047 (wrong rows_read value)
FLUSH
INDEX_STATISTICS
;
FLUSH
TABLE_STATISTICS
;
SET
@
userstat_old
=
@@
userstat
;
SET
GLOBAL
userstat
=
ON
;
CREATE
TABLE
t1
(
id
int
(
10
),
PRIMARY
KEY
(
id
));
INSERT
INTO
t1
VALUES
(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
7
),(
8
),(
9
),(
10
);
SELECT
COUNT
(
*
)
FROM
t1
;
SELECT
ROWS_READ
FROM
INFORMATION_SCHEMA
.
TABLE_STATISTICS
WHERE
TABLE_NAME
=
't1'
;
SELECT
ROWS_READ
FROM
INFORMATION_SCHEMA
.
INDEX_STATISTICS
WHERE
TABLE_NAME
=
't1'
;
# Test that FLUSH clears one table but not another
FLUSH
TABLE_STATISTICS
;
SELECT
ROWS_READ
FROM
INFORMATION_SCHEMA
.
TABLE_STATISTICS
WHERE
TABLE_NAME
=
't1'
;
SELECT
ROWS_READ
FROM
INFORMATION_SCHEMA
.
INDEX_STATISTICS
WHERE
TABLE_NAME
=
't1'
;
# Test that FLUSH clears both tables now
FLUSH
INDEX_STATISTICS
;
SELECT
ROWS_READ
FROM
INFORMATION_SCHEMA
.
INDEX_STATISTICS
WHERE
TABLE_NAME
=
't1'
;
# Test that stats are collected after the FLUSH again
SELECT
COUNT
(
*
)
FROM
t1
;
SELECT
ROWS_READ
FROM
INFORMATION_SCHEMA
.
TABLE_STATISTICS
WHERE
TABLE_NAME
=
't1'
;
SELECT
ROWS_READ
FROM
INFORMATION_SCHEMA
.
INDEX_STATISTICS
WHERE
TABLE_NAME
=
't1'
;
DROP
TABLE
t1
;
# Bug 1183625 (handler::update_global_table_stats crash).
CREATE
TABLE
t2
(
c1
INT
UNSIGNED
);
ALTER
TABLE
t2
MODIFY
c1
FLOAT
;
SELECT
*
FROM
INFORMATION_SCHEMA
.
TABLE_STATISTICS
WHERE
TABLE_NAME
=
't2'
;
DROP
TABLE
t2
;
# Bug 1183625 (handler::update_global_table_stats crash).
CREATE
TABLE
t2
(
c1
INT
UNSIGNED
)
ENGINE
=
InnoDB
;
ALTER
TABLE
t2
MODIFY
c1
FLOAT
;
SELECT
*
FROM
INFORMATION_SCHEMA
.
TABLE_STATISTICS
WHERE
TABLE_NAME
=
't2'
;
DROP
TABLE
t2
;
SET
GLOBAL
userstat
=
@
userstat_old
;
mysql-test/suite/innodb/r/table_index_statistics.result
0 → 100644
View file @
e4a0d75a
SET @default_storage_engine_old = @@session.default_storage_engine;
SET SESSION default_storage_engine = INNODB;
FLUSH INDEX_STATISTICS;
FLUSH TABLE_STATISTICS;
SET @userstat_old= @@userstat;
SET GLOBAL userstat=ON;
CREATE TABLE t1 (id int(10), PRIMARY KEY (id));
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
SELECT COUNT(*) FROM t1;
COUNT(*)
10
SELECT ROWS_READ FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t1';
ROWS_READ
10
SELECT ROWS_READ FROM INFORMATION_SCHEMA.INDEX_STATISTICS WHERE TABLE_NAME='t1';
ROWS_READ
10
FLUSH TABLE_STATISTICS;
SELECT ROWS_READ FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t1';
ROWS_READ
SELECT ROWS_READ FROM INFORMATION_SCHEMA.INDEX_STATISTICS WHERE TABLE_NAME='t1';
ROWS_READ
10
FLUSH INDEX_STATISTICS;
SELECT ROWS_READ FROM INFORMATION_SCHEMA.INDEX_STATISTICS WHERE TABLE_NAME='t1';
ROWS_READ
SELECT COUNT(*) FROM t1;
COUNT(*)
10
SELECT ROWS_READ FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t1';
ROWS_READ
10
SELECT ROWS_READ FROM INFORMATION_SCHEMA.INDEX_STATISTICS WHERE TABLE_NAME='t1';
ROWS_READ
10
DROP TABLE t1;
CREATE TABLE t2 (c1 INT UNSIGNED);
ALTER TABLE t2 MODIFY c1 FLOAT;
SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t2';
TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES
DROP TABLE t2;
CREATE TABLE t2 (c1 INT UNSIGNED) ENGINE=InnoDB;
ALTER TABLE t2 MODIFY c1 FLOAT;
SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t2';
TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES
DROP TABLE t2;
SET GLOBAL userstat= @userstat_old;
SET SESSION default_storage_engine = @default_storage_engine_old;
mysql-test/suite/innodb/t/table_index_statistics.test
0 → 100644
View file @
e4a0d75a
--
source
include
/
have_innodb
.
inc
SET
@
default_storage_engine_old
=
@@
session
.
default_storage_engine
;
SET
SESSION
default_storage_engine
=
INNODB
;
--
source
extra
/
table_index_statistics
.
inc
SET
SESSION
default_storage_engine
=
@
default_storage_engine_old
;
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