ShawnYan 发表于 5 天前

turbo 执行计划打印到error log

test case:

mysql> create schema mydbt;
Query OK, 1 row affected (0.02 sec)

mysql> create table mydbt.t1 (id int);
Query OK, 0 rows affected (0.01 sec)

mysql> insert mydbt.t1 select 1;
Query OK, 1 row affected, 1 warning (0.00 sec)
Records: 1Duplicates: 0Warnings: 1

Warning (Code 8585): turbo does not support this sql statement: {"exception_type":"Parser","exception_message":"From DUAL clause is not yet supported"}
mysql> insert mydbt.t1 select 1;
Query OK, 1 row affected, 1 warning (0.00 sec)
Records: 1Duplicates: 0Warnings: 1

Warning (Code 8585): turbo does not support this sql statement: {"exception_type":"Parser","exception_message":"From DUAL clause is not yet supported"}
mysql> insert mydbt.t1 select 1;
Query OK, 1 row affected, 1 warning (0.00 sec)
Records: 1Duplicates: 0Warnings: 1

Warning (Code 8585): turbo does not support this sql statement: {"exception_type":"Parser","exception_message":"From DUAL clause is not yet supported"}
mysql>
mysql>
mysql> EXPLAIN analyze SELECT /*+ SET_VAR(turbo_enable=ON) SET_VAR(turbo_cost_threshold=0) */ * FROM mydbt.t1;
+-----------------------------------------------------------------------------------------------------------+
| EXPLAIN                                                                                                   |
+-----------------------------------------------------------------------------------------------------------+
| -> Turbo scan
    -> Table scan on t1, column(id)(cost=0.3, row=3) (actual time=4.887 rows=3 loops=1)

|
+-----------------------------------------------------------------------------------------------------------+
1 row in set (0.02 sec)

mysql> show var^C
^C
mysql> show variables like '%turbo%';
+---------------------------------+--------------------+
| Variable_name                   | Value            |
+---------------------------------+--------------------+
| turbo_compat_func               | ON               |
| turbo_condition_pushdown      | OFF                |
| turbo_cost_threshold            | 0.000000         |
| turbo_enable                  | ON               |
| turbo_enable_ps_and_sp          | ON               |
| turbo_enable_rollback         | OFF                |
| turbo_enable_warning            | ON               |
| turbo_exec                      |                  |
| turbo_index_range               | ON               |
| turbo_max_temp_directory_size   | 1073741824         |
| turbo_memory_limit            | 268435456          |
| turbo_parallel_read_buffer_size | 2097152            |
| turbo_release_retries         | 600                |
| turbo_retry_pause               | 1000               |
| turbo_skip_charset_check      | OFF                |
| turbo_temp_directory            | duckdb_dp.data.tmp |
| turbo_worker_threads            | 4                  |
+---------------------------------+--------------------+
17 rows in set (0.00 sec)

查看error log

# tail /var/log/mysqld.log
Turbo scan
    -> Table scan on t1, column(id)(cost=0.3, row=3) (actual time=1085.682 rows=3 loops=1)



Turbo scan
    -> Table scan on t1, column(id)(cost=0.3, row=3) (actual time=4.887 rows=3 loops=1)





这不符合预期吧?



ShawnYan 发表于 5 天前

warn 参数关掉也报

mysql> set turbo_enable_warning = off;
Query OK, 0 rows affected (0.00 sec)

mysql> EXPLAIN analyze SELECT /*+ SET_VAR(turbo_enable=ON) SET_VAR(turbo_cost_threshold=0) */ * FROM mydbt.t1;
+------------------------------------------------------------------------------------------------------------+
| EXPLAIN                                                                                                    |
+------------------------------------------------------------------------------------------------------------+
| -> Turbo scan
    -> Table scan on t1, column(id)(cost=0.3, row=3) (actual time=11.060 rows=3 loops=1)

|
+------------------------------------------------------------------------------------------------------------+
1 row in set (0.03 sec)


error log
Turbo scan
    -> Table scan on t1, column(id)(cost=0.3, row=3) (actual time=11.060 rows=3 loops=1)

yejr 发表于 5 天前

ShawnYan 发表于 2025-4-17 12:57
warn 参数关掉也报




经验证,结果的确如此,谢谢严老师的报告,我们会作为issue提交

reddey 发表于 前天 14:26

ShawnYan 发表于 2025-4-17 12:57
warn 参数关掉也报




优秀
页: [1]
查看完整版本: turbo 执行计划打印到error log