<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/mysql-9-7-community-edition-smarter-join-planning-with-the-hypergraph-optimizer-ista0aar3" -->

---
title: MySQL 9.7 Community Edition: Smarter Join Planning with...
description: MySQL 9.7 Community Edition makes the Hypergraph Optimizer available to all users. Unlike the traditional cost-based optimizer that uses heuristics to narrow...
canonical: https://daily.dev/posts/mysql-9-7-community-edition-smarter-join-planning-with-the-hypergraph-optimizer-ista0aar3
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: MySQL 9.7 Community Edition: Smarter Join Planning with the Hypergraph Optimizer | daily.dev
og:description: MySQL 9.7 Community Edition makes the Hypergraph Optimizer available to all users. Unlike the traditional cost-based optimizer that uses heuristics to narrow...
og:url: https://daily.dev/posts/mysql-9-7-community-edition-smarter-join-planning-with-the-hypergraph-optimizer-ista0aar3
og:image: https://api.daily.dev/og/posts/iSta0aaR3.png
og:image:alt: MySQL 9.7 Community Edition: Smarter Join Planning with the Hypergraph Optimizer
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# MySQL 9.7 Community Edition: Smarter Join Planning with the Hypergraph Optimizer

**[Planet MySQL](https://daily.dev/sources/planet-mysql)** · 11 min read · 4 upvotes · 0 comments

## Summary

MySQL 9.7 Community Edition makes the Hypergraph Optimizer available to all users. Unlike the traditional cost-based optimizer that uses heuristics to narrow join order search space, the Hypergraph Optimizer models queries as a graph of table relationships, enabling it to explore a broader set of join orders and discover more efficient execution plans. A real-world example with 8-table joins shows the Hypergraph plan introducing an early hash join that reduced execution time from ~451ms to ~122ms — a ~4x improvement — without any SQL changes. The optimizer can be enabled per-query via inline hint, per-session, or globally. However, it's not a universal performance switch: simpler queries may see no benefit or even slight regressions. The recommendation is to test with EXPLAIN ANALYZE on representative data volumes before enabling broadly.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blogs.oracle.com/mysql/smarter-join-planning-with-the-hypergraph-optimizer>

## Questions this post answers

### How do I enable the Hypergraph Optimizer for a single query in MySQL 9.7?

Use an inline optimizer hint directly in the query: SELECT /*+ SET_VAR(optimizer_switch='hypergraph_optimizer=on') */ followed by the rest of the statement. This limits the change to a single statement, making it easy to compare execution plans side by side since only the optimizer differs between runs. Session-level and global enabling are also available via SET SESSION or SET GLOBAL optimizer_switch commands.

_Developers piloting MySQL 9.7's hypergraph optimizer can find real benchmarks and tuning notes on daily.dev._

### Does the Hypergraph Optimizer in MySQL always produce faster queries than the traditional optimizer?

No, results vary by workload. In one multi-table join test, Hypergraph cut execution time from about 451 ms to 122 ms, roughly a 4x improvement, by choosing an early hash join instead of a linear nested-loop chain. But for simpler queries with less join-order complexity, execution time can be nearly identical to the traditional optimizer, and the added optimization effort can occasionally make performance worse.

_Anyone deciding whether to flip on hypergraph optimization can compare real-world MySQL benchmarks on daily.dev._

### What changed in the execution plan when MySQL used the Hypergraph Optimizer instead of the traditional one for a multi-join query?

The traditional optimizer followed a linear nested-loop chain starting with a table scan on the archived orders table, joining sequentially through customer, sales_order, seller, sales_line, product, and order_items tables. Hypergraph instead built a hash table and used an inner hash join on the customer_id columns to combine current and archived order branches early, reducing rows flowing into later joins and cutting runtime from 451 ms to 122 ms.

_Engineers debugging join order regressions can track MySQL optimizer behavior changes like this on daily.dev._

## Similar posts on daily.dev

- [Inside MySQL 9.7 LTS Features](https://daily.dev/posts/inside-mysql-9-7-lts-features-4ld8ccbg5) · Percona Blog · 30 upvotes · 1 comments
- [How the Other Half Plans](https://daily.dev/posts/how-the-other-half-plans-2eb26obic) · Planet PostgreSQL · 4 upvotes · 0 comments
- [Resolving query plan regressions after a MySQL engine upgrade](https://daily.dev/posts/resolving-query-plan-regressions-after-a-mysql-engine-upgrade-7oliv3023) · AWS Database Blog · 0 upvotes · 0 comments

---

Tags: [#backend](https://daily.dev/tags/backend), [#sql](https://daily.dev/tags/sql), [#mysql](https://daily.dev/tags/mysql)

[View this post on daily.dev](https://daily.dev/posts/mysql-9-7-community-edition-smarter-join-planning-with-the-hypergraph-optimizer-ista0aar3)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"MySQL 9.7 Community Edition: Smarter Join Planning with the Hypergraph Optimizer","url":"https://daily.dev/posts/mysql-9-7-community-edition-smarter-join-planning-with-the-hypergraph-optimizer-ista0aar3","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/mysql-9-7-community-edition-smarter-join-planning-with-the-hypergraph-optimizer-ista0aar3"},"datePublished":"2026-07-22T07:10:02.360Z","dateModified":"2026-09-14T07:39:01.994Z","description":"MySQL 9.7 Community Edition makes the Hypergraph Optimizer available to all users. Unlike the traditional cost-based optimizer that uses heuristics to narrow...","image":"https://media.daily.dev/image/upload/s--HRgLpUt6--/f_auto/v1722860399/public/Placeholder%2003","thumbnailUrl":"https://media.daily.dev/image/upload/s--HRgLpUt6--/f_auto/v1722860399/public/Placeholder%2003","isAccessibleForFree":true,"articleSection":"Planet MySQL","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Planet MySQL","logo":"https://media.daily.dev/image/upload/s--UKAtmXTq--/f_auto,q_auto/v1780213421/logos/planet-mysql?_a=BAMAMiWQ0","url":"https://daily.dev/sources/planet-mysql"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/mysql-9-7-community-edition-smarter-join-planning-with-the-hypergraph-optimizer-ista0aar3","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":4},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"backend,sql,mysql","timeRequired":"PT11M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Planet MySQL","item":"https://daily.dev/sources/planet-mysql"},{"@type":"ListItem","position":3,"name":"MySQL 9.7 Community Edition: Smarter Join Planning with the Hypergraph Optimizer"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/mysql-9-7-community-edition-smarter-join-planning-with-the-hypergraph-optimizer-ista0aar3#faq","mainEntity":[{"@type":"Question","name":"How do I enable the Hypergraph Optimizer for a single query in MySQL 9.7?","acceptedAnswer":{"@type":"Answer","text":"Use an inline optimizer hint directly in the query: SELECT /*+ SET_VAR(optimizer_switch='hypergraph_optimizer=on') */ followed by the rest of the statement. This limits the change to a single statement, making it easy to compare execution plans side by side since only the optimizer differs between runs. Session-level and global enabling are also available via SET SESSION or SET GLOBAL optimizer_switch commands. Developers piloting MySQL 9.7's hypergraph optimizer can find real benchmarks and tuning notes on daily.dev."}},{"@type":"Question","name":"Does the Hypergraph Optimizer in MySQL always produce faster queries than the traditional optimizer?","acceptedAnswer":{"@type":"Answer","text":"No, results vary by workload. In one multi-table join test, Hypergraph cut execution time from about 451 ms to 122 ms, roughly a 4x improvement, by choosing an early hash join instead of a linear nested-loop chain. But for simpler queries with less join-order complexity, execution time can be nearly identical to the traditional optimizer, and the added optimization effort can occasionally make performance worse. Anyone deciding whether to flip on hypergraph optimization can compare real-world MySQL benchmarks on daily.dev."}},{"@type":"Question","name":"What changed in the execution plan when MySQL used the Hypergraph Optimizer instead of the traditional one for a multi-join query?","acceptedAnswer":{"@type":"Answer","text":"The traditional optimizer followed a linear nested-loop chain starting with a table scan on the archived orders table, joining sequentially through customer, sales_order, seller, sales_line, product, and order_items tables. Hypergraph instead built a hash table and used an inner hash join on the customer_id columns to combine current and archived order branches early, reducing rows flowing into later joins and cutting runtime from 451 ms to 122 ms. Engineers debugging join order regressions can track MySQL optimizer behavior changes like this on daily.dev."}}]}
```

