Skip to content

Instantly share code, notes, and snippets.

@mdcallag
Created June 4, 2018 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdcallag/40612e5cb75ade3975dd120e9c5c4a6d to your computer and use it in GitHub Desktop.
Save mdcallag/40612e5cb75ade3975dd120e9c5c4a6d to your computer and use it in GitHub Desktop.
CREATE TABLE `sbtest1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`k` int(11) NOT NULL DEFAULT '0',
`c` char(120) NOT NULL DEFAULT '',
`pad` char(60) NOT NULL DEFAULT '',
KEY `xid` (`id`),
KEY `k_1` (`k`)
) ENGINE=InnoDB AUTO_INCREMENT=2000001 DEFAULT CHARSET=latin1;
bin/mysql test -e 'explain SELECT c
FROM sbtest1
WHERE id IN (1000001, 1000002, 1000003, 1000004, 1000005, 1000006, 1000007, 1000008, 1000009, 1000010,
1000011, 1000012, 1000013, 1000014, 1000015, 1000016, 1000017, 1000018, 1000019, 1000020,
1000021, 1000022, 1000023, 1000024, 1000025, 1000026, 1000027, 1000028, 1000029, 1000030,
1000031, 1000032, 1000033, 1000034, 1000035, 1000036, 1000037, 1000038, 1000039, 1000040,
1000041, 1000042, 1000043, 1000044, 1000045, 1000046, 1000047, 1000048, 1000049, 1000050,
1000051, 1000052, 1000053, 1000054, 1000055, 1000056, 1000057, 1000058, 1000059, 1000060,
1000061, 1000062, 1000063, 1000064, 1000065, 1000066, 1000067, 1000068, 1000069, 1000070,
1000071, 1000072, 1000073, 1000074, 1000075, 1000076, 1000077, 1000078, 1000079, 1000080,
1000081, 1000082, 1000083, 1000084, 1000085, 1000086, 1000087, 1000088, 1000089, 1000090,
1000091, 1000092, 1000093, 1000094, 1000095, 1000096, 1000097, 1000098, 1000099, 1000100)'
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: sbtest1
partitions: NULL
type: range
possible_keys: xid
key: xid
key_len: 4
ref: NULL
rows: 100
filtered: 100.00
Extra: Using index condition
bin/mysql test -e 'show indexes from sbtest1\G'
mysql: [Warning] Using a password on the command line interface can be insecure.
*************************** 1. row ***************************
Table: sbtest1
Non_unique: 1
Key_name: xid
Seq_in_index: 1
Column_name: id
Collation: A
Cardinality: 1921330
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
Visible: YES
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment