Skip to content

Instantly share code, notes, and snippets.

@mdcallag
Created April 9, 2026 23:25
Show Gist options
  • Select an option

  • Save mdcallag/f532ef990d7f06df0338f431ad75147f to your computer and use it in GitHub Desktop.

Select an option

Save mdcallag/f532ef990d7f06df0338f431ad75147f to your computer and use it in GitHub Desktop.
--- MySQL 9.7.0 with the z12a config (hypergraph optimizer disabled)
explain SELECT DISTINCT c FROM sbtest1 WHERE id BETWEEN 28428495 AND 28429494 ORDER BY c
-> Sort: sbtest1.c
-> Table scan on <temporary> (cost=794..820 rows=1838)
-> Temporary table with deduplication (cost=794..794 rows=1838)
-> Filter: (sbtest1.id between 28428495 and 28429494) (cost=371 rows=1838)
-> Index range scan on sbtest1 using PRIMARY over (28428495 <= id <= 28429494) (cost=371 rows=1838)
--- MySQL 9.7.0 with the z12b config (hypergraph optimizer enabled)
explain SELECT DISTINCT c FROM sbtest1 WHERE id BETWEEN 41462615 AND 41463614 ORDER BY c
-> Sort with duplicate removal: sbtest1.c (cost=2797..2797 rows=1838)
-> Filter: (sbtest1.id between 41462615 and 41463614) (cost=0.826..1519 rows=1838)
-> Index range scan on sbtest1 using PRIMARY over (41462615 <= id <= 41463614) (cost=0.769..1413 rows=1838)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment