1414 <a href =" https://hub.docker.com/repository/docker/kangrongme/videx " >
1515 <img src="https://img.shields.io/docker/pulls/kangrongme/videx?style=for-the-badge&logo=docker" alt="Docker Pulls"/>
1616 </a >
17+ <img src =" https://img.shields.io/badge/MySQL|Percona-8.0|_5.7-FF9800?style=for-the-badge&logo=mysql " alt =" MySQL Support " />
1718</p >
1819
1920** VIDEX** : The Disaggregated, Extensible ** \[ VI\] ** rtual in** \[ DEX\] ** Engine for What-If Analysis in MySQL 🚀
@@ -40,8 +41,8 @@ By default, VIDEX includes implementations based on histograms and NDV collected
4041
4142VIDEX offers two startup modes:
4243
43- 1 . ** Plugin to production database** : Install VIDEX as a plugin to the production database instance.
44- 2 . ** Individual instance** : This mode can completely avoid impacting the stability of online running instances, making it practical for industrial environments.
44+ 1 . ** Plugin to production database** (Plugin-Mode) : Install VIDEX as a plugin to the production database instance.
45+ 2 . ** Individual instance** (Standalone-Mode) : This mode can completely avoid impacting the stability of online running instances, making it practical for industrial environments.
4546
4647Functionally, VIDEX supports creating and deleting indexes (single-column indexes, composite indexes, EXTENDED_KEYS indexes, [ descending indexes] ( https://dev.mysql.com/doc/en/descending-indexes.html ) ).
4748However, it currently does not support functional indexes, FULL-Text, and Spatial Indexes.
@@ -117,7 +118,7 @@ If you haven't installed Docker yet:
117118
118119#### Launch VIDEX Container
119120``` bash
120- docker run -d -p 13308:13308 -p 5001:5001 --name videx kangrongme/videx:0.0.2
121+ docker run -d -p 13308:13308 -p 5001:5001 --name videx kangrongme/videx:latest
121122```
122123
123124> ** Alternative Deployment Options**
@@ -129,7 +130,7 @@ docker run -d -p 13308:13308 -p 5001:5001 --name videx kangrongme/videx:0.0.2
129130
130131## 3 Examples
131132
132- ### 3.1 TPCH-Tiny Example
133+ ### 3.1 TPCH-Tiny 示例 (MySQL 8.0)
133134
134135This example demonstrates the complete VIDEX workflow using the ` TPC-H Tiny ` dataset (1% random sample from TPC-H sf1).
135136
@@ -279,7 +280,63 @@ ALTER TABLE tpch_tiny.orders DROP INDEX idx_o_orderstatus;
279280ALTER TABLE videx_tpch_tiny .orders DROP INDEX idx_o_orderstatus;
280281```
281282
282- ### 3.2 TPCH sf1 (1g) Example
283+ ### 3.2 TPCH-Tiny Example (MySQL 5.7)
284+
285+ VIDEX now supports high-precision simulation for MySQL 5.7 in the standalone mode.
286+
287+ #### Step 1: Import Test Data into MySQL 5.7 Instance
288+
289+ Import data into a MySQL 5.7 instance.
290+
291+ ``` bash
292+ mysql -h${HOST_MYSQL57} -P13308 -uvidex -ppassword -e " create database tpch_tiny_57;"
293+ mysql -h${HOST_MYSQL57} -P13308 -uvidex -ppassword -Dtpch_tiny_57 < tpch_tiny.sql
294+ ```
295+
296+ #### Step 2: VIDEX Collection and Import of VIDEX Metadata
297+
298+ VIDEX employs a different data collection method for MySQL 5.7 compared to MySQL 8.0,
299+ while maintaining the same command parameters.
300+
301+ ``` bash
302+ cd $VIDEX_HOME
303+ python src/sub_platforms/sql_opt/videx/scripts/videx_build_env.py \
304+ --target ${HOST_MYSQL57} :13308:tpch_tiny_57:videx:password \
305+ --videx 127.0.0.1:13308:videx_tpch_tiny_57:videx:password
306+ ```
307+
308+ #### Step 2.5: ✴️ Setting Parameters Adapted for MySQL 5.7
309+
310+ VIDEX can simulate MySQL 5.7 in standalone mode. Due to the differences between MySQL 5.7 and MySQL 8.0, we
311+ need to set the ` optimizer-switch ` variables and ` server_cost ` tables for VIDEX-optimizer.
312+
313+ ✴️✴️ Note that, Since ** setting the environment does not take effect in the current connection** , please run the following script first,
314+ then log into MySQL.
315+
316+ ``` bash
317+ mysql -h ${HOST_MYSQL57} -P13308 -uvidex -ppassword < src/sub_platforms/sql_opt/videx/scripts/setup_mysql57_env.sql
318+ ```
319+
320+ #### Step 3: EXPLAIN SQL
321+
322+ We will use TPC-H Q21 as an example. The EXPLAIN result is as follows. We can see that the query plan for MySQL 5.7
323+ differs significantly from MySQL 8.0, yet VIDEX can still simulate it accurately:
324+
325+ ![ explain_tpch_tiny_table_for_mysql57.png] ( doc/explain_tpch_tiny_table_for_mysql57.png )
326+
327+ Below is a comparison of EXPLAIN cost details between MySQL 5.7 and VIDEX.
328+
329+ ![ explain_tpch_tiny_mysql57_compare.png] ( doc/explain_tpch_tiny_mysql57_compare.png )
330+
331+ #### Step 4: ✴️ Clear MySQL 5.7 Environment Variables
332+
333+ If you wish to revert the MySQL-optimizer to MySQL 8.0, please run the following script.
334+
335+ ``` bash
336+ mysql -h ${HOST_MYSQL57} -P13308 -uvidex -ppassword < src/sub_platforms/sql_opt/videx/scripts/clear_mysql57_env.sql
337+ ```
338+
339+ ### 3.3 TPCH sf1 (1g) Example (MySQL 8.0)
283340
284341We provide metadata file for TPC-H sf1: ` data/videx_metadata_tpch_sf1.json ` , allowing direct import without collection.
285342
0 commit comments