注册

视图中有union,怎么使用hint指定union后面的sql使用索引扫描

~ 2023/05/22 826 3

为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】:8
【操作系统】:linux
【CPU】:
【问题描述】*:
select a.username from v_user a where a.userid = 123;
其中视图语句是:
create view v_user as
select username ,userid from user_table1 u
union
select username ,userid from user_table2 u
union
select u.username ,u.userid from
(select username ,userid ,age from user_table3 ut) u
where u.age > 20
类似这种sql,目前达梦在最后一个union的执行计划是全表扫描,没有先执行 userid = 123 的过滤条件。请问该怎么优化?

回答 0
暂无回答
扫一扫
联系客服