moven
moven
mysql binlog can log sql comment
@adriancole i use mybatis plugin to interceptor dml sql,add trace id to sql comment u also can intercept sql in jdbc api i think
```java // add traceid to sql comment String sql = boundSql.getSql(); if (mappedStatement.getSqlCommandType() != SqlCommandType.SELECT) { sql = binlogTraceService.generateTraceComment(sql); } ```
like this: ```sql /*__trace_start__{"traceId":"159aad5c8bc089","userId":0}__trace_end__*/ insert into msg_log (`id`,`data`) values (?,?) ```
like this: https://dba.stackexchange.com/questions/101651/show-sql-statements-from-mysql-binlog-gtid
> Some database systems create and cache query plans based on the query matching and it's not certain they're sophisticated enough or willing to take the performance hit to do...
一定要本机测试,前端代码写死127.0.0.1啦