config root man

Current Path : /usr/opt/mysql57/mysql-test/suite/perfschema/t/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //usr/opt/mysql57/mysql-test/suite/perfschema/t/digest_view.test

# ----------------------------------------------------
# Tests for the performance schema statement Digests.
# ----------------------------------------------------

# Test case to show behavior of statements digest when
# using a view

--source include/not_embedded.inc
--source include/have_perfschema.inc
--source include/no_protocol.inc

CREATE TABLE test.v1 (a int, b int);
INSERT INTO test.v1 VALUES (1, 100), (2, 200), (3, 300);

CREATE TABLE test.t1 (a int, b int);
INSERT INTO test.t1 VALUES (1, 100), (2, 200), (3, 300);


TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;

#
# test.v1 is a table.
# Every query here is different, and should have a different digest.
#

EXPLAIN SELECT * from test.v1;
EXPLAIN SELECT * from test.v1 where a = 1;
EXPLAIN SELECT * from test.v1 where b > 100;
EXPLAIN SELECT a, b from test.v1;
EXPLAIN SELECT b, a from test.v1;

SELECT * from test.v1;
SELECT * from test.v1 where a = 1;
SELECT * from test.v1 where b > 100;
SELECT a, b from test.v1;
SELECT b, a from test.v1;

--echo #
--echo # DIGESTS SEEN ON TABLE
--echo #

SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR
  FROM performance_schema.events_statements_summary_by_digest
  ORDER BY DIGEST_TEXT;

DROP TABLE test.v1;
CREATE VIEW test.v1 AS SELECT * FROM test.t1;

#
# test.v1 is now a view.
# the query digests should be unchanged.
#

EXPLAIN SELECT * from test.v1;
EXPLAIN SELECT * from test.v1 where a = 1;
EXPLAIN SELECT * from test.v1 where b > 100;
EXPLAIN SELECT a, b from test.v1;
EXPLAIN SELECT b, a from test.v1;

SELECT * from test.v1;
SELECT * from test.v1 where a = 1;
SELECT * from test.v1 where b > 100;
SELECT a, b from test.v1;
SELECT b, a from test.v1;

--echo #
--echo # DIGESTS SEEN ON VIEW
--echo #

SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR
  FROM performance_schema.events_statements_summary_by_digest
  ORDER BY DIGEST_TEXT;

DROP VIEW test.v1;
DROP TABLE test.t1;


Man Man