2. One transaction contain following
statements
• Point queries: SELECT c FROM test_latin WHERE id=N
• Range queries: SELECT c FROM test_latin WHERE id BETWEEN N AND M
• Range SUM() queries: SELECT SUM(K) FROM test_latin WHERE id
BETWEEN N and M
• Range ORDER BY queries:SELECT c FROM test_latin WHERE id between N
and M ORDER BY c
• Range DISTINCT queries:SELECT DISTINCT c FROM test_latin WHERE id
BETWEEN N and M ORDER BY c
• UPDATEs on index column:UPDATE test_latin SET k=k+1 WHERE id=N
• UPDATEs on non-index column:UPDATE test_latin SET c=N WHERE id=M
• DELETE queries:DELETE FROM test_latin WHERE id=N
• INSERT queries:INSERT INTO test_latin VALUES (...)
3. Set session parameters
• Set Limit for total number of requests=500
• Set inserting records =1000000
• Set Range size for range queries=100
• Set Number of point select queries in a single transaction=10
• Set Number of simple range queries in a single transaction=1
• Set Number of SUM range queries in a single transaction=1
• Set Number of ORDER range queries in a single transaction=1
• Set Number of DISTINCT range queries in a single transaction =1
• Set Number of index UPDATE queries in a single transaction=1
• Set Number of non-index UPDATE queries in a single transaction =1
• Set Time in microseconds to sleep after each connection to database =
1000
• Set Minimum time in microseconds to sleep after each request =0
• Set Maximum time in microseconds to sleep after each request =0
4. Tables structure
CREATE TABLE test_latin (
id int(10) unsigned NOT NULL,
k int(10) unsigned NOT NULL DEFAULT '0',
c char(120) NOT NULL DEFAULT '',
pad char(60) NOT NULL DEFAULT '',
PRIMARY KEY (id),
KEY k (k)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
CREATE TABLE test_utf8 (
id int(10) unsigned NOT NULL,
k int(10) unsigned NOT NULL DEFAULT '0',
c char(120) NOT NULL DEFAULT '',
pad char(60) NOT NULL DEFAULT '',
PRIMARY KEY (id),
KEY k (k)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
5. Create testing data scripts
DROP PROCEDURE IF EXISTS insert_data_english;
DELIMITER //
CREATE PROCEDURE insert_data_english()
BEGIN
DECLARE vCount bigint(12) DEFAULT 1;
DECLARE vK bigint(12) DEFAULT 1;
DECLARE vbuyerName varchar(128) DEFAULT '0bzhonglizhongli';
DECLARE vSellerName varchar(128) DEFAULT '0szhonglizhongli';
SET AUTOCOMMIT=0;
WHILE vCount<=1000000 DO
INSERT INTO test_latin(id,k,c,pad)
VALUES(vCount,vK,vSellerName,vbuyerName);
INSERT INTO test_utf8(id,k,c,pad)
VALUES(vCount,vK,vSellerName,vbuyerName);
set vCount=vCount+1;
IF MOD(vCount,5000)=0 THEN
set vK=vK+1;
set vbuyerName=concat(vCount,'bzhonglizhongli');
set vSellerName=concat(vCount,'szhonglizhongli');
COMMIT;
END IF;
END WHILE;
COMMIT;
END;
//
DELIMITER ;
6. Result --using English characters
Name latin1 utf8
Concurrent Transactions:141.17 per sec Transactions:96.88 per sec
threads=8 read/write requests:2682.26 per sec. read/write requests:1840.80 per sec
total time:3.5418s total time:5.1608s
Concurrent Transactions:180.04 per sec Transactions:169.45 per sec
threads=16 read/write requests:3420.82 per sec read/write requests:3219.54 per sec
total time:2.7771s total time:2.9507s
11. Result --using Chinese characters
Name latin1 utf8
Concurrent Transactions:177.59 per sec Transactions:115.20 per sec
threads=8 read/write requests:3374.16 per sec read/write requests:2188.76 per sec
total time:2.8155s total time:4.3404s
Concurrent Transactions:160.13 per sec Transactions:123.72 per sec
threads=16 read/write requests:3042.41 per sec read/write requests:2350.69 per sec
total time:3.1225s total time:4.0414s