nerdexam
Oracle

1Z0-888 · Question #3

Consider: mysql> EXPLAIN SELECT FROM City WHERE Name = 'Jacksonville' AND CountryCode = 'USA'\G *********************** 1. row ************************ id: 1 select_type: SIMPLE table: city type…

The correct answer is A. It shows how many bytes will be used from each index row. key_len reports the number of bytes MySQL will read from each index entry to satisfy the query - it's a byte-length measurement of the index prefix actually used. Here, key_len: 13 means MySQL is consuming 13 bytes of the name_country_index, which corresponds to both the Name…

Performance Tuning

Question

Consider: mysql> EXPLAIN SELECT * FROM City WHERE Name = 'Jacksonville' AND CountryCode = 'USA'\G *************************** 1. row *************************** id: 1 select_type: SIMPLE table: city type: ref possible_keys: name_country_index key: name_country_index key_len: 13 ref: const, const rows: 1 Extra: Using where Which statement best describes the meaning of the value for the key_len column?

Options

  • AIt shows how many bytes will be used from each index row.
  • BIt shows the number of characters indexed in the key.
  • CIt shows the total size of the index row.
  • DIt shows how many columns in the index are examined.

How the community answered

(13 responses)
  • A
    77% (10)
  • B
    8% (1)
  • C
    15% (2)

Explanation

key_len reports the number of bytes MySQL will read from each index entry to satisfy the query - it's a byte-length measurement of the index prefix actually used. Here, key_len: 13 means MySQL is consuming 13 bytes of the name_country_index, which corresponds to both the Name and CountryCode columns being fully used (as confirmed by ref: const, const).

Why the distractors are wrong:

  • B is wrong because key_len is always in bytes, not characters - a critical distinction when multi-byte charsets (e.g., UTF-8) are involved, where one character can occupy 2–4 bytes.
  • C is wrong because key_len only reflects the used portion of the index, not the full index row size (which includes internal overhead MySQL doesn't expose here).
  • D is wrong because key_len is a byte count, not a column count - you must infer the number of columns used by knowing each column's byte width and doing the math yourself.

Memory tip: Think of key_len as the "ruler measurement" of how far into the index key MySQL reaches - bigger bytes = more of the index is being used, which generally means a more selective, efficient lookup.

Topics

#EXPLAIN statement#Index optimization#Key length#Query execution

Community Discussion

No community discussion yet for this question.

Full 1Z0-888 Practice