Hi

你使用的是flink-connector-jdbc
3.0.0-1.16版本吧?需要使用3.0.0-1.17,不过目前应该还没有release,你可以关注下

On Wednesday, April 26, 2023, 杨扬 <yangya...@cupdata.com> wrote:

> 各位大佬好!
>         目前升级到了flink1.17+jdbc-3.0,经过测试依然没有实现谓词下推,想请教下这是为什么?
>
>
>
>
> > 在 2022年12月5日,下午3:05,rovo98 <rov...@foxmail.com> 写道:
> >
> > 你好,请留意您使用的 flink 版本。在 flink 1.17, jdbc-3.0.0 版本之前,jdbc connector 没有实现
> SupportsFilterPushDown 接口(谓词下推),所以发送至数据库的查询是 select xxx from table_name
> 的全表扫描形式。
> >
> >
> > 如有需要可参考 FLINK-16024 对您使用的 jdbc connector 版本进行修改。
> >
> >
> >
> >
> > https://issues.apache.org/jira/browse/FLINK-16024
> > https://github.com/apache/flink/pull/20140
> >
> >
> > ------------------&nbsp;原始邮件&nbsp;------------------
> > 发件人:
>                                                     "user-zh"
>                                                                       <
> yangya...@cupdata.com&gt;;
> > 发送时间:&nbsp;2022年12月5日(星期一) 下午2:43
> > 收件人:&nbsp;"user-zh"<user-zh@flink.apache.org&gt;;
> >
> > 主题:&nbsp;sql查询数据库不走索引
> >
> >
> >
> > 各位好!
> >       目前有一使用flink-sql编写的作业,其中存在通过jdbc查询mysql中某张表A需求,A表“
> b字段”为索引字段,但是flink-sql查询无法走到该表索引查询,为全表扫描查询。
> >       代码类似于
> > CREATE TABLE A (
> > b decimal(4, 0),
> > ...,
> > ...
> > ) WITH (
> > 'connector' = 'jdbc',
> > 'url' = 'jdbc:mysql://100.191.200.10:9999/lldb',
> > 'username' = 'test',
> > 'password' = 'Test!123',
> > 'table-name' = ‘A’
> > )
> > select * from A where b = 1234;
> > 此时发送至数据库的查询为select * from A去掉了后面的where筛选条件,从而无法使用b字段索引查询,变为全表扫描。
> >
> > 此问题是否有办法解决呢?难道flink-sql是先在数据库中全表扫描,再在flink中执行筛选?这样数据库的查询效率极低。
> > =======================================================
> > 此邮件已由 Deep Discovery Email Inspector 进行了分析。
>
>

回复