Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't decode/unpack keys unless requested
Summary: This branch checks gets rid of expensive decoding/unpacking of the key fields unless they requested by higher layers. The method can be further optimized to decode keys fields partially when not all fields of the key are requested but this branch doesn't tackle it as it would take more effort and gives improvement for much less cases. I've found one more implicit demand for unpacking/decoding key in addition to merge, which is update of auto increment value. Test Plan: Run count select on a 15G table with utf8_bin collation top access performance gain. Observed 16% time reduction for count query and 13% time reduction for SUM query using full scan table and extracting non-key column. mysql> select count(count) from assoc_count; +--------------+ | count(count) | +--------------+ | 320435881 | +--------------+ 1 row in set (2 min 59.28 sec) <-- before change 1 row in set (2 min 30.80 sec) <-- after change mysql> select sum(count) from assoc_count; +--------------+ | sum(count) | +--------------+ | 619505329429 | +--------------+ 1 row in set (3 min 13.79 sec) <-- before change 1 row in set (2 min 48.82 sec) <-- after change The table definition: CREATE TABLE `assoc_count` ( `id` bigint(20) unsigned NOT NULL DEFAULT '0', `id_type` int(10) unsigned NOT NULL DEFAULT '0', `assoc_type` bigint(20) unsigned NOT NULL DEFAULT '0', `count` int(10) unsigned NOT NULL DEFAULT '0', `time` int(10) unsigned NOT NULL DEFAULT '0', `version` bigint(20) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`,`assoc_type`) COMMENT 'cf_assoc_count' ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin ROW_FORMAT=COMPACT; Reviewers: mung, herman Reviewed By: herman Subscribers: webscalesql-eng@fb.com, phabricatorlinter Differential Revision: https://phabricator.intern.facebook.com/D5909811 Tasks: T21813614 Signature: 5909811:1507610696:b2b2d2a92d5e8c4c9f7f9f58f758cf4245559f12
- Loading branch information