~drizzle-trunk/drizzle/development

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
--disable_warnings
DROP TABLE IF EXISTS a;
DROP TABLE IF EXISTS b;
--enable_warnings
CREATE TABLE a (i int,  PRIMARY KEY (i));
ALTER TABLE a ADD COLUMN j int;
DROP TABLE A;
CREATE TABLE a (i int,  PRIMARY KEY (i));
INSERT INTO a VALUES (1);
DELETE FROM a WHERE i=1;
START TRANSACTION;
INSERT INTO a VALUES (1);
ROLLBACK;
START TRANSACTION;
INSERT INTO a VALUES (1);
COMMIT;

# The statistics are incremented after the statements have already returned
# so its possible a query could be missed if we do not wait
--sleep 1 
--sorted_result
SELECT USER, COUNT_SELECT, COUNT_DELETE, COUNT_UPDATE, COUNT_INSERT, COUNT_ROLLBACK, COUNT_COMMIT, COUNT_CREATE, COUNT_ALTER, COUNT_DROP, COUNT_ADMIN  FROM DATA_DICTIONARY.CURRENT_SQL_COMMANDS WHERE user != "root";

# disable the plugin
set global logging_stats_enable=false;
--sorted_result
SELECT USER, COUNT_SELECT, COUNT_DELETE, COUNT_UPDATE, COUNT_INSERT, COUNT_ROLLBACK, COUNT_COMMIT, COUNT_CREATE, COUNT_ALTER, COUNT_DROP, COUNT_ADMIN FROM DATA_DICTIONARY.CURRENT_SQL_COMMANDS WHERE user != "root";
# renable it
set global logging_stats_enable=true;


#check the stats for the current session
SHOW CREATE TABLE data_dictionary.SESSION_STATEMENTS;
--replace_column 1 #
--sorted_result
SELECT count(*) FROM data_dictionary.SESSION_STATEMENTS;
--sorted_result
SELECT * FROM data_dictionary.SESSION_STATEMENTS;

#check stats for all active sessions
connect (con1, localhost, root,,);
CREATE TABLE b (i int,  PRIMARY KEY (i));
INSERT INTO b VALUES (1);
connect (con2, localhost, drizzle,,);
INSERT INTO b VALUES (2);



--sleep 1
--sorted_result
SELECT USER, COUNT_SELECT, COUNT_DELETE, COUNT_UPDATE, COUNT_INSERT, COUNT_ROLLBACK, COUNT_COMMIT, COUNT_CREATE, COUNT_ALTER, COUNT_DROP, COUNT_ADMIN FROM DATA_DICTIONARY.CURRENT_SQL_COMMANDS  WHERE user != "root";

#dont select memory usage it will vary between 32/64 bit and compilers
--sorted_result
SELECT SCOREBOARD_SIZE, NUMBER_OF_RANGE_LOCKS, MAX_USERS_LOGGED FROM DATA_DICTIONARY.SCOREBOARD_STATISTICS;

DROP TABLE a,b;