WHERE EXISTS vs IN in Amazon Redshift

只愿长相守 提交于 2019-12-11 06:56:27

问题


I run EXPLAIN on two versions of the same query in Amazon Redshift:

SELECT t1.column
FROM table1 t1
WHERE t1.column IN
(SELECT t2.column FROM table2 t2);

SELECT t1.column
FROM table1 t1
WHERE EXISTS
(SELECT 1 FROM table2 t2 WHERE t1.column = t2.column );

They seem to have the same query plan. Does that mean that there is no performance difference between IN and WHERE EXISTS as Redshift somehow optimizes the SQL input before compiling the query?

来源:https://stackoverflow.com/questions/50800120/where-exists-vs-in-in-amazon-redshift

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!