简体   繁体   English

在SQL中加入性能临时表

[英]join performance temp table in sql

In my database for somereasons not all table have foreign key then for have a better performance I used a select into (with data filtered) in a temp table , I did this for the tables I'll use for to have a better performance but now.... 在我的数据库中,出于某种原因,并非所有表都具有外键,然后为了获得更好的性能,我在temp表中使用了select(过滤数据)功能,我这样做是为了使表具有更好的性能,但是现在....

In the final result when I need do join between those table (temp table can't have foreign key, isn't it?) do not have foreign key I got "Merge Join" (I understand they are caused because my temp table does not have foreign key) 在最终结果中,当我需要在这些表之间进行联接(临时表不能具有外键,不是吗?)没有外键时,我得到了“合并联接”(我理解它们是由于我的临时表引起的)没有外键)

合并加入

(If you dont see the pic I reupload it at here) https://ibb.co/f0XRHv (如果您没有看到图片,我会在这里重新上传) https://ibb.co/f0XRHv

How about using something like suggested in the following answer? 如何使用以下答案中建议的内容?

No foreign key restraints on a temporary table? 临时表上没有外键约束吗? SQL Server 2008 SQL Server 2008

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM