多线程CPU占100%的峰值

多线程CPU占100%的峰值

本文介绍了多线程CPU占100%的峰值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 大家好, 我有一个运行查询的查询,在多线程上运行时达到100%。你可以帮助调整以下查询并避免cPU峰值。Hi Everyone, I have a query running for an applications which spikes to 100% while running on multiple threads. Could you please help in tuning the below query and avoid cPU spike.select SubTable.RelationId, SubTable.NickName, SubTable.ProductTypeCode, SubTable.SubProductTypeCode, SubTable.CurrencyCode,Users.UserId, Users.Name, Users.Lang, Users.UserLoginId, Users.UserLoginIdBase, Users.SendUnsolicitMessages,Users.SMSCountryCode, Users.SMSNumber, Users.SMSAllowed, Users.SMSActivationStatus, Users.SMSTermsAndConditions, Users.SMSDailyThreshold,Loyalty.BranchCode, Loyalty.BranchName, Loyalty.BranchCountryfrom SubTable WITH(NOLOCK), Users WITH(NOLOCK), Loyalty WITH(NOLOCK) whereSubTable.AccountNumber = @P1 andSubTable.AccountExternalId = @P2 andSubTable.SubProductTypeCode = @P3 andSubTable.CurrencyCode = @P4 andSubTable.UserId = Users.UserId andUsers.ActivationFlag = 'Y' andSubTable.BranchIdRl = Loyalty.BranchId 谢谢, Manowj。 我的尝试: b $ b 尝试增加CPU内存和分页。Thanks,Manowj.What I have tried:tried increasing the CPU memory and pagination.推荐答案使用正确的表连接从多个中选择(google) sql select join table,你会找到例子)。如果cpu尖峰就是这样,那么一个快速死亡的尖峰就不用担心了。除了连接之外,查询中没有任何内容可以进行优化,您必须通过添加索引来优化表以便快速选择。Use proper table joins to select from multiple (google "sql select join table" and you'll find examples). If the cpu spike is just that, a spike that quickly dies then it's nothing to worry about. Beyond the joins there is nothing in your query that can be optimised, you'd have to optimise the table for fast selecting by adding indexes.我遇到了同样的问题。基本上我们需要检查参与此查询的那些列/字段。认为你需要运行查询执行计划并检查 以下是我使用过的一些有用链接并对问题进行了分类 执行计划基础 - 简单谈话 [ ^ ] 显示图形执行计划(SQL Server Management Studio) [ ^ ] 查询执行计划 [ ^ ] 了解SQL Server查询执行计划 - Developer.com [ ^ ]I had the same issue. Basically we need to check for those columns/fields who participate in this query. Think you need to run query execution plan and checkHere are some useful links which I had used and sorted the issue Execution Plan Basics - Simple Talk[^]Displaying Graphical Execution Plans (SQL Server Management Studio)[^]Query Execution Plans[^]Understanding a SQL Server Query Execution Plan - Developer.com[^] 这篇关于多线程CPU占100%的峰值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-07 09:22