2015-08-24 00:37:21 +02:00
|
|
|
SET GLOBAL net_write_timeout = 900;
|
2012-09-03 20:01:52 +02:00
|
|
|
CREATE TABLE A (
|
|
|
|
pk INTEGER AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
fdate DATE
|
|
|
|
) ENGINE=MyISAM;
|
|
|
|
CREATE PROCEDURE p_analyze()
|
|
|
|
BEGIN
|
|
|
|
DECLARE attempts INTEGER DEFAULT 100;
|
|
|
|
wl_loop: WHILE attempts > 0 DO
|
|
|
|
ANALYZE TABLE A;
|
|
|
|
SET attempts = attempts - 1;
|
|
|
|
END WHILE wl_loop;
|
|
|
|
END |
|
|
|
|
CREATE FUNCTION rnd3() RETURNS INT
|
|
|
|
BEGIN
|
|
|
|
RETURN ROUND(3 * RAND() + 0.5);
|
|
|
|
END |
|
|
|
|
SET GLOBAL use_stat_tables = PREFERABLY;
|
|
|
|
DROP TABLE A;
|
|
|
|
DROP PROCEDURE p_analyze;
|
|
|
|
DROP FUNCTION rnd3;
|
|
|
|
SET GLOBAL use_stat_tables = DEFAULT;
|
2015-08-24 00:37:21 +02:00
|
|
|
SET GLOBAL net_write_timeout = DEFAULT;
|