title: I caught huge queries in DB and can not find the source of that
body: <p>I am actually just looking for opinions if someone had similar experience rather than an exact solution of my problem.</p>
  <p>My project is Asp.net core 2.2 mvc project with abp framework, One of my customers has its own servers instead of cloud, sometimes(one or two times in a day) DB server's CPU hits 100% and stays there for a long time and locks out every transaction, this makes me have to restart the sql service. Everytime when that happens I am restarting the service to solve this problem but obviously this is not a permanent solution.</p>
  <p>I upgraded the project to <strong>Asp.net core 6 and everything else is up to date now</strong> but that customer's DB and services are so huge because of that it will not be easy to upgrade them, I am probably going to upgrade them in the next months</p>
  <p>I tracked database transactions when CPU hits 100%, and I found a weird query that gets millions of millions row from DB and I can't find its source, this query lasts more than 4 hours, it doesn't look like SQL injection or EF query</p>
  <p>Just small part of the query looks like this</p>
  <p><code>SELECT &quot;Col1201&quot;,&quot;Col1204&quot;,&quot;Col1206&quot;,&quot;Col1210&quot;,&quot;Col1193&quot;,&quot;Col1196&quot;,&quot;Col1191&quot;,&quot;Col1138&quot;,&quot;Col1139&quot;,&quot;Col1140&quot;,&quot;Col1143&quot;,&quot;Col1144&quot;,&quot;Col1146&quot;,&quot;Col1148&quot;,&quot;Col1149&quot;,&quot;Col1150&quot;,&quot;Col1170&quot;,&quot;Col1174&quot;,&quot;Col1178&quot;,&quot;Col1179&quot;,&quot;Col1180&quot;,&quot;Col1181&quot;,&quot;Col1182&quot;,&quot;Col1183&quot;,&quot;Col1184&quot;,&quot;Col1185&quot;,&quot;Col1117&quot;,&quot;Col1120&quot;,&quot;Col1122&quot;,&quot;Col1123&quot;,&quot;Col1124&quot;,&quot;Col1126&quot;,&quot;Col1129&quot;,&quot;Col1130&quot;,&quot;Col1132&quot;,&quot;Col1133&quot;,&quot;Col1134&quot;,&quot;Col1154&quot;,&quot;Col1157&quot;,&quot;Col1158&quot;,&quot;Col1159&quot;,&quot;Col1161&quot;,&quot;Col1164&quot;,&quot;Col1166&quot;,&quot;Col1104&quot;,&quot;Col1108&quot;,&quot;Col1111&quot;,&quot;Col1078&quot;,&quot;Col1081&quot;,&quot;Col1083&quot;,&quot;Col1087&quot;,&quot;Col1052&quot;,&quot;Col1055&quot;,&quot;Col1057&quot;,&quot;Col1061&quot;,&quot;Col1026&quot;,&quot;Col1029&quot;,&quot;Col1031&quot;,&quot;Col1035&quot;,CASE WHEN &quot;Col1143&quot;=N'TrainingContent' THEN &quot;Col1111&quot; ELSE CASE WHEN &quot;Col1143&quot;=N'TrainingExam' THEN &quot;Col1087&quot; ELSE CASE WHEN &quot;Col1143&quot;=N'TrainingSurvey' THEN &quot;Col1061&quot; ELSE CASE WHEN &quot;Col1143&quot;=N'TrainingTask' THEN &quot;Col1035&quot; ELSE @P1 END END END END &quot;Expr1023&quot;,&quot;Col1223&quot;,&quot;Col1218&quot;,&quot;Col1212&quot;,&quot;Col1202&quot;,&quot;Col1203&quot;,&quot;Col1219&quot;,&quot;</code></p>
  <p>I searched DB logs, app data logs and server logs at the time when CPU hits 100% and I couldn't find its source</p>
  <p>When I try to open profiler for a day, it makes all system halt so I can't do that</p>
  <p>I am tired and confused right now. Can this be solved when I upgrade everything in the project?</p>