且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

慢SQL查询性能

更新时间:2022-11-27 12:18:17

我不明白为什么你加入tbl3。 t3.addrs = t2.addrs ,因此你可以 SELECT t1.date,t1.name,t2.name,t2.addrs ,不是吗?

或者tbl3中的记录中是否存在tbl3中没有记录,并且您希望仅在两个表中都存在记录?

此外,您可以在SQL Server管理工作室中执行querey。查看查询的执行计划,它可能会给你一些提示(例如表扫描而不是使用索引)。
I do not understand why you join tbl3. "t3.addrs = t2.addrs", consequently you can "SELECT t1.date, t1.name, t2.name, t2.addrs", can''t you?
Or is it possible that no record exists in tbl3 for a record in tbl2, and you want to get records existing in both tables only?
Furthermore, you can execute the querey in SQL Server management studio. Look at the execution plan of the query, it might give you some hints (e.g. "table scan" instead of use of an index).