docker_mysql

command
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 28 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

SQL GunYu MySQL Demo

Build the image from the repository root:

docker build -f examples/docker_mysql/Dockerfile -t sql-gunyu-demo:local .

After changing the source, rebuild the image and recreate the container. Restarting an existing container keeps its original image; it does not compile the current working tree or use a newly rebuilt image with the same tag.

With the image available locally, run:

docker run --rm -p 127.0.0.1:8080:8080 sql-gunyu-demo:local

Wait for the ready message and open localhost:8080. Click Analyze SQL to inspect the prefilled query for recent paid orders. It selects all columns from orders. The table starts with only a primary key (id, enabling B-Tree sampling) and no secondary indexes. The suggested composite index serves the tenant and status predicates and leaves other outputs to the table read. In Findings, look for the static rule that flags wrapping created_at in DATE() in the WHERE clause. The page opens in English on the first visit. The language selector switches the page and report between English and Simplified Chinese and saves the selection across refreshes. The report shows the execution stages, MySQL EXPLAIN, findings with links to their recommendations, and a before-and-after cost comparison. Expand a recommendation to inspect modeled access paths and validation details. You can copy the proposed SQL and download the analysis record as JSON. Use the + and − buttons next to the SQL editor to step through 18 built-in example queries ordered from simplest (primary key lookup) to most complex (4-table JOINs, correlated EXISTS/NOT EXISTS, nullable NOT IN, CTEs, window functions, and UNION), or jump directly to any query from the Example queries selector. Expand any table under Demo schema to see its definition, indexes, and sample rows.

The single image starts MySQL 8.4.10 with four e-commerce tables: 5,000 customers, 2,000 products (with idx_category), 120,000 orders (primary key only), and 180,000 order_items (primary key only, nullable coupon_code, with ~10% of orders having no items). Tenant 1001 owns 60,000 orders. The data and statistics are initialized in a fresh, disposable directory on each start. Web requests use a read-only account over a private Unix socket. The Demo accepts one SELECT at a time and shows suggestions for review. The plan comes from MySQL EXPLAIN. Candidate benefits are sql-gunyu model estimates.

Press Ctrl+C to stop the demo. For a browser on the same machine, keep the host port bound to 127.0.0.1.

To verify a built image, run the disposable smoke test with Docker, curl, and jq:

./examples/docker_mysql/smoke.sh sql-gunyu-demo:local

It checks the seeded page and 4 demo tables, the native full scan of orders, the static findings and composite index recommendation in English and Chinese, the customer primary key lookup, and a 3-table JOIN across orders, order_items, and products. It uses an available loopback port and a 512 MiB memory limit, prints the measured startup and memory usage, and removes the temporary container.

Documentation

Overview

Command docker_mysql serves the SQL GunYu demo with a disposable MySQL instance.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL