SQL是否总是在加入后的位置,并且很快吗?
说,我有两个大表格 - A和B。
我想从A中拿走3行,并将它们加入B:
select * from A join B
on A.externalKey = B.externalKey
where A.id in (1, 2, 3)
Will SQL(即PostgreSQL)的3行,认识到在加入之前应用的速度更快,因为条件取决于条件,仅在A的参数上?
如果否,是使用AS(从Where ...中选择 *)从Join B
更快地选择 *的最佳方法?
Say, I have two big tables - A and B.
I want to take 3 rows from A and join them to 3 rows from B:
select * from A join B
on A.externalKey = B.externalKey
where A.id in (1, 2, 3)
Will SQL (namely, PostgreSQL) recognize that it's faster to apply WHERE before JOIN, because the condition depends only on A's parameters?
If no, is with A as (select * from A where ...) select * from A join B
faster and the best way to do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论