Database data traffic is too big - problem diagnosis

problem:

Operation and maintenance of a reporting station database, data traffic is too large, the specific value is not clear. Other than the normal flow database.

 

problem analysis:

The amount of traffic data, database access One guess is increased (unlikely, the basic rule), and second, some items sql query large amounts of data in a single table. There may be screened query access is too large.

 

company project:

dotnet4.5、entityframe work 6.1.3、sqlServer

 

Approach:

1, sqlServer statistic data returned by the query

https://docs.microsoft.com/zh-cn/sql/relational-databases/system-dynamic-management-views/sys-dm-exec-query-stats-transact-sql?view=sql-server-2017

SELECT TOP 50
qs.total_worker_time/qs.execution_count as [Avg CPU Time],
SUBSTRING(qt.text,qs.statement_start_offset/2,
(case when qs.statement_end_offset = -1
then len(convert(nvarchar(max), qt.text)) * 2
else qs.statement_end_offset end -qs.statement_start_offset)/2)
as query_text,
qt.dbid, dbname=db_name(qt.dbid),
qt.objectid ,
qs.total_rows,qs.last_rows ,qs.max_rows ,qs.min_rows
FROM sys.dm_exec_query_stats qs
cross apply sys.dm_exec_sql_text(qs.sql_handle) as qt
ORDER BY total_rows DESC;

2, the above query, sql query found a table, where no conditions.

And then the corresponding program, code verification, where the conditions found in Entity FrameWork not generated.

Specific code is not in my hands. EF no business code.

where the principle of generating conditions, please see the details of the Entity FrameWork.

 

Guess you like

Origin www.cnblogs.com/suzixuan/p/12600432.html
Recommended