| 1 |
# |
| 2 |
# Performance Schema |
| 3 |
# |
| 4 |
# Verify that the Performance Schema correctly identifies normal and temporary |
| 5 |
# tables with non-standard names. |
| 6 |
|
| 7 |
# The server uses the table name prefix "#sql" for temporary and intermediate |
| 8 |
# tables, however user-defined tables having the "#sql" prefix are also permitted. |
| 9 |
# Independent of the table name, temporary or intermediate tables always have the |
| 10 |
# "#sql" prefix in the filename. (For non-temporary tables starting with "#", |
| 11 |
# the "#" is encoded to @0023 in the filename.) |
| 12 |
# |
| 13 |
# Given the ambiguity with temporary table names, the Performance Schema identifies |
| 14 |
# temporary tables tables either by the table category or by the filename. |
| 15 |
# |
| 16 |
|
| 17 |
--echo |
| 18 |
--echo # |
| 19 |
--echo # TEST 1: Temporary tables, no special prefix. |
| 20 |
--echo # |
| 21 |
--echo |
| 22 |
CREATE TEMPORARY TABLE sql_temp2_innodb (a int, b text) ENGINE=INNODB; |
| 23 |
INSERT INTO sql_temp2_innodb VALUES(1,'one'); |
| 24 |
--echo |
| 25 |
--echo # Confirm that the temporary tables are ignored. |
| 26 |
--echo |
| 27 |
SELECT object_type, object_schema, object_name |
| 28 |
FROM performance_schema.objects_summary_global_by_type |
| 29 |
WHERE object_schema="test" |
| 30 |
ORDER BY object_name; |
| 31 |
--echo |
| 32 |
--echo # Drop the tables, verify that the table objects are not created. |
| 33 |
--echo |
| 34 |
DROP TABLE sql_temp2_innodb; |
| 35 |
--echo |
| 36 |
SELECT object_type, object_schema, object_name |
| 37 |
FROM performance_schema.objects_summary_global_by_type |
| 38 |
WHERE object_schema="test" |
| 39 |
ORDER BY object_name; |
| 40 |
|
| 41 |
--echo |
| 42 |
--echo # |
| 43 |
--echo # TEST 2: Temporary tables with the "#sql" prefix. |
| 44 |
--echo # |
| 45 |
--echo |
| 46 |
CREATE TEMPORARY TABLE `#sql_temp3_innodb` (a int, b text) ENGINE=INNODB; |
| 47 |
CHECK TABLE `#sql_temp3_innodb`; |
| 48 |
INSERT INTO `#sql_temp3_innodb` VALUES(1,'one'); |
| 49 |
--echo |
| 50 |
--echo # Confirm that the temporary tables are ignored. |
| 51 |
--echo |
| 52 |
SELECT object_type, object_schema, object_name |
| 53 |
FROM performance_schema.objects_summary_global_by_type |
| 54 |
WHERE object_schema="test" |
| 55 |
ORDER BY object_name; |
| 56 |
--echo |
| 57 |
--echo # Drop the temporary tables. |
| 58 |
--echo |
| 59 |
DROP TABLE `#sql_temp3_innodb`; |
| 60 |
--echo |
| 61 |
--echo # Confirm that the temporary tables are still ignored. |
| 62 |
--echo |
| 63 |
SELECT object_type, object_schema, object_name |
| 64 |
FROM performance_schema.objects_summary_global_by_type |
| 65 |
WHERE object_schema="test" |
| 66 |
ORDER BY object_name; |
| 67 |
|
| 68 |
--echo |
| 69 |
--echo # Confirm that no tables remain; |
| 70 |
--echo |
| 71 |
SELECT object_type, object_schema, object_name |
| 72 |
FROM performance_schema.objects_summary_global_by_type |
| 73 |
WHERE object_schema="test" |
| 74 |
ORDER BY object_name; |