What is "Database Wait Statistics" in Business Central?

 Introduction:

“Wait” typically refers to the amount of time during which a database session waits for an event to complete before it can proceed with execution.
Waits can arise for many reasons in a database system, and understanding them is important for  tuning and optimizing performance.

References:

Explanation:

Waits, in SQL, are broadly categorized into three categories:

Resource Waits:
These happen when a worker needs access to a resource like data or system resources, but it's not available because another worker is using it.
Examples include waiting for locks, system latches, or for data to be read from the network or disk.

Queue Waits
Occur when a worker is waiting for a task to be assigned to it.
Think of it like waiting in line for a job to do.
This commonly occurs with system tasks like deadlock detection or cleaning up deleted records.
Even if there's no immediate task, workers might still check periodically.

External Waits
This occurs when a worker is waiting for something outside the SQL Server environment to finish, like a call to an external procedure or a query to a linked server.
It's important to note that just because a worker is in external wait doesn't mean it's idle; it might be actively running external code.

In context of Business Central, we see the following "wait" types:






Buffer IO: This type of wait occurs when a database session is waiting for data to be read from or written to the buffer cache, which is an area of memory used to cache data pages from disk.

Buffer Latch: Buffer latch waits happen when a session is waiting to acquire a latch on a buffer in memory. Latches are used to protect access to in-memory data structures, and buffer latch waits can occur when multiple sessions are contending for access to the same buffer.

Compilation: Compilation waits occur when a session is waiting for a SQL query or stored procedure to be compiled and optimized by the database engine.

CPU: CPU waits occur when a session is waiting for CPU resources to become available for query processing.

Idle: Idle waits occur when a session is not actively performing any work and is waiting for something to do.

Latch: Latch waits, as mentioned earlier, happen when a session is waiting to acquire a latch on a data structure in memory.

Lock: Lock waits occur when a session is waiting for a lock on a resource that is held by another session.

Memory: Memory waits occur when a session is waiting for memory resources to become available. This can include waits for memory allocations, deallocations, or other memory-related operations.

Network IO: Network IO waits occur when a session is waiting for data to be sent or received over a network connection.

Other: This category typically includes waits that don't fit into the other specific categories listed.

Other Disk IO: This is similar to Buffer IO waits but encompasses other disk-related operations beyond just buffer reads and writes.

Parallelism: Parallelism waits occur when a session is waiting for other parallel threads to complete their tasks.

Preemptive: Preemptive waits occur when a session is waiting for an external operation to complete, such as an operating system call.

Service Broker: Service Broker waits occur when a session is waiting for a message to be sent or received via the Service Broker feature in SQL Server.

SQL CLR: SQL CLR waits occur when a session is waiting for a Common Language Runtime (CLR) operation to complete.

Tran Log IO: Transaction Log IO waits occur when a session is waiting for data to be read from or written to the transaction log.

Transaction: Transaction waits occur when a session is waiting for a transaction to complete.

User Wait: User waits are general-purpose waits that occur when a session is waiting for some user-defined event to occur.

Worker Thread: Worker thread waits occur when a session is waiting for a worker thread to become available for query processing.

Conclusion:

Thus, we saw how we can use the "Database Wait Statistics" in Business Central to identify performance bottlenecks in the system.

Comments

Popular posts from this blog

Using Notifications in Business Central via AL

Actionable Error Messages in Business Central

Configure Gmail SMTP service in Business Central without "Allow Less Secure" setting