简体   繁体   English

相同的表,SQL 服务器查询中的不同表现

[英]Identical tables, different performance in SQL Server query

We've been having problems with performance for a SQL Server at work.我们在工作中遇到了 SQL 服务器的性能问题。 Queries that run well on one server run awfully on another (eg 20 minutes vs 16 hours, same box specs, seemingly same setup).在一台服务器上运行良好的查询在另一台服务器上运行得非常糟糕(例如 20 分钟与 16 小时,相同的盒子规格,看似相同的设置)。

To try and understand the issue, I set up a update query (around 2m record table).为了尝试理解这个问题,我设置了一个更新查询(大约 2m 的记录表)。 When I tried to run it on a particular table, it could take anywhere up to 20 minutes to run.当我尝试在特定表上运行它时,它可能需要长达 20 分钟才能运行。 When I create a copy of that same table (ie select * into new table ) and run the same query on the copy it only takes 30 seconds.当我创建同一张表的副本(即select * into new table )并在副本上运行相同的查询时,只需要 30 秒。

For info, none of the tables have indexes on them.有关信息,所有表都没有索引。

I'm a bit limited in terms of what info I can share, but any ideas what could be causing an issue like this?我可以分享的信息有点有限,但是有什么想法可能导致这样的问题吗?

Creating just another table might not have all the indexes was created on the original table along with the data,or Query optimization configs might not be the same as the original table.仅创建另一个表可能不会在原始表上创建所有索引以及数据,或者查询优化配置可能与原始表不同。 DBAs will be able to help you why its talking this much time. DBA 将能够帮助您为什么要花这么多时间。

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

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