SQL Server 中的 PAGEIOLATCH_SH 等待类型是什么?

What is PAGEIOLATCH_SH wait type in SQL Server?(SQL Server 中的 PAGEIOLATCH_SH 等待类型是什么?)
本文介绍了SQL Server 中的 PAGEIOLATCH_SH 等待类型是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个查询在交易过程中花费了很长时间.当我得到进程的 wait_type 时,它是 PAGEIOLATCH_SH.

I have a query that is taking a long time in the middle of a transaction. When I get the wait_type of the process it is PAGEIOLATCH_SH.

这种等待类型是什么意思,如何解决?

What does this wait type mean and how can this be resolved?

推荐答案

来自 Microsoft 文档:

PAGEIOLATCH_SH

当任务正在等待 I/O 请求中的缓冲区的闩锁时发生.锁存请求处于共享模式.长时间等待可能表明磁盘子系统有问题.

Occurs when a task is waiting on a latch for a buffer that is in an I/O request. The latch request is in Shared mode. Long waits may indicate problems with the disk subsystem.

在实践中,这几乎总是由于对大表的大量扫描而发生.在高效使用索引的查询中几乎不会发生这种情况.

In practice, this almost always happens due to large scans over big tables. It almost never happens in queries that use indexes efficiently.

如果您的查询是这样的:

If your query is like this:

Select * from <table> where <col1> = <value> order by <PrimaryKey>

,检查您在 (col1, col_primary_key) 上是否有复合索引.

, check that you have a composite index on (col1, col_primary_key).

如果你没有,那么你需要一个完整的INDEX SCAN(如果选择了PRIMARY KEY),或者一个SORTcode> 如果选择了 col1 上的索引.

If you don't have one, then you'll need either a full INDEX SCAN if the PRIMARY KEY is chosen, or a SORT if an index on col1 is chosen.

它们都是对大型表的I/O 消耗大量磁盘的操作.

Both of them are very disk I/O consuming operations on large tables.

这篇关于SQL Server 中的 PAGEIOLATCH_SH 等待类型是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Execute complex raw SQL query in EF6(在EF6中执行复杂的原始SQL查询)
SSIS: Model design issue causing duplications - can two fact tables be connected?(SSIS:模型设计问题导致重复-两个事实表可以连接吗?)
SQL Server Graph Database - shortest path using multiple edge types(SQL Server图形数据库-使用多种边类型的最短路径)
Invalid column name when using EF Core filtered includes(使用EF核心过滤包括时无效的列名)
How should make faster SQL Server filtering procedure with many parameters(如何让多参数的SQL Server过滤程序更快)
How can I generate an entity–relationship (ER) diagram of a database using Microsoft SQL Server Management Studio?(如何使用Microsoft SQL Server Management Studio生成数据库的实体关系(ER)图?)