All Products
Search
Document Center

PolarDB:Fast traverse

Last Updated:Mar 28, 2026

For tables with tens of millions of rows, COUNT(*) and full-index scans are expensive: MySQL ships each row up to the SQL layer before processing it, causing heavy CPU overhead and long query latency. Fast traverse eliminates this by pushing execution down to the InnoDB storage engine layer and traversing pages using the index the optimizer selects — not always the primary key.

Supported versions

Fast traverse requires PolarDB for MySQL 8.0, with one of the following revision versions:

  • 8.0.1.1.5 or later

  • 8.0.2.2.0 or later

To check your cluster version, see Query the engine version.

How it works

MySQL Community Edition 8.0.13 does not execute COUNT(*) in InnoDB at all, pushing every row to the SQL layer for counting. MySQL Community Edition 8.0.18 added page-level traversal in InnoDB, but always uses the primary key index regardless of what the optimizer selects.

Fast traverse removes both limitations:

  • Traverses InnoDB pages using the index the optimizer selects, not the primary key

  • Avoids the prolonged page locks and Multi-Version Concurrency Control (MVCC) version-restoration overhead that table lookups cause

Fast traverse is enabled by default on all supported PolarDB for MySQL clusters — no configuration required.

Verify that fast traverse is active

Run EXPLAIN on your query and inspect the output. In this example using the TPC-H lineitem table:

mysql> EXPLAIN SELECT COUNT(*) FROM lineitem\G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: lineitem
   partitions: NULL
         type: index
possible_keys: NULL
          key: i_l_shipdate
      key_len: 4
          ref: NULL
         rows: 59440464
     filtered: 100.00
        Extra: Using index

Performance

The following results use TPC-H at scale factor 10, with innodb_parallel_read_threads set to 1. PolarDB clusters with fast traverse outperform MySQL Community Edition 8.0.13 and 8.0.18.

Performance of fast traverse

FAQ

What is the default value of innodb_parallel_read_threads in PolarDB for MySQL?

The default value is 0. To change it, see Configure cluster and node parameters.