June 2024 Discount: Comprehensive Database Performance Health Check | Testimonials

sql task state

SQL SERVER – Life of a SQL Query – Query States

This is the guest blog post written by James Davies, Sales Engineer, Confio Software, a SolarWinds company. It is written based on the Database Performance Analyzer . I encourage you to download it for free from here.

From the moment a query request is made until the query response is delivered, what really happens to your query in SQL Server? Let’s find out, and talk about why that matters to you.

Put simply, queries in SQL Server can exist in one of three states while executing inside the database engine. These states are defined as:

  • RUNNING–meaning that the query is actively running on the CPU
  • RUNNABLE–meaning that the query is ready to run but CPU resources are not yet available. It is waiting in the Runnable Queue for a CPU to open up
  • SUSPENDED–meaning that the query is waiting for a third party resource to become available (for example,, disk I/O, blocking and so on)

In an overly simplified way, it’s a bit like the checkout line at the grocery store, in which each shopper has just one item. The cashier is the CPU and the item the checker is actively scanning is like a query that is running. The shoppers waiting in line, each with their own item, are like runnable queries, just waiting to be scanned and checked out. Let’s say that when the checker scans your item, the price doesn’t come up, and a price check is called. The checker asks you to step aside, and wait for the price check to complete. When the price comes back, the checker asks you to step back in line, all the way at the end of the line. That’s like a suspended query (and that’s not something you want to happen to your query!). If there are four checkout lines running, then that would be a bit like having four CPU cores, each with their own set of queries in various states of running, runnable and suspended.

So then what is a wait type? In SQL Server wait types are simply a more detailed explanation of the suspension state. As DBAs, we don’t like to see queries in the suspended state, and want to find out just what is causing the query not to process.

When you look at wait statistics, you want to see queries spending the majority of their time in a running or runnable state. You can also use wait statistics to discover why a query is in a suspended state. If you can answer that question, you can fix the problem so that the query is mostly in a non-suspended state. And this is why understanding your query wait statistics is key to maximizing query performance.

You can look at wait statistics using SQL Server Management Studio (SSMS) or third-party tools such as SolarWinds Database Performance Analyzer (DPA) . DPA provides simple, fast and visual identification of query wait statistics correlated with system resources, including historical and trend information, so that you can easily pinpoint root cause of query performance issues.

SQL SERVER - Life of a SQL Query - Query States dpa-wait-stats

Whichever tools you use, understanding query states and wait statistics is the foundation to a good proactive database performance practice.

Reference: Pinal Dave ( https://blog.sqlauthority.com )

Related Posts

Sql server – guest post – glenn berry – wait type – day 26 of 28, sql server – introduction to wait stats and wait types – wait type – day 1 of 28.

slow query

SQL SERVER – 5 Important Steps When Query Runs Slow Occasionally

2 comments . leave new.

' src=

Please explain how OLTP entity relationship consisting of two dimensional table whereas DWH is multi- dimensional table?

' src=

Hi , can you plz provide me a scipt by which i can shrink all the log files on the instance.thanks a lot.

Leave a Reply Cancel reply

Pinal Dave is an SQL Server Performance Tuning Expert and independent consultant with over 22 years of hands-on experience. He holds a Masters of Science degree and numerous database certifications.

Pinal has authored 13 SQL Server database books and 74 Pluralsight courses. To freely share his knowledge and help others build their expertise, Pinal has also written more than 5,700 database tech articles on his blog at https://blog.sqlauthority.com .

Pinal is an experienced and dedicated professional with a deep commitment to flawless customer service. If you need help with any SQL Server Performance Tuning Issues , please feel free to reach out at [email protected] .

Pinal is also a CrossFit Level 1 Trainer (CF-L1) and CrossFit Level 2 Trainer (CF-L2) .

Nupur Dave is a social media enthusiast and an independent consultant. She primarily focuses on the database domain, helping clients build short and long-term multi-channel campaigns to drive leads for their sales pipeline.

Comprehensive Database Performance Health Check

Is your SQL Server running slow and you want to speed it up without sharing server credentials? In my Comprehensive Database Performance Health Check , we can work together remotely and resolve your biggest performance troublemakers in less than 4 hours .

Once you learn my business secrets, you will fix the majority of problems in the future.

SQL Server Performance Tuning Practical Workshop

Have you ever opened any PowerPoint deck when you face SQL Server Performance Tuning emergencies? SQL Server Performance Tuning Practical Workshop is my MOST popular training with no PowerPoint presentations and 100% practical demonstrations .

Essentially I share my business secrets to optimize SQL Server performance.

sql task state

Database administration Automate critical tasks for database administration

  • Auditing and compliance
  • Database backup
  • Disaster recovery
  • Forensic auditing
  • Index defragmentation
  • Inventory management
  • Load testing
  • Object level restore
  • Server compare
  • SQL job automation
  • SQL Server monitoring
  • Transaction log reading
  • Transactional replication

Database development Integrate database changes and automate deployments

  • Continuous delivery
  • Continuous integration
  • Data compare
  • Data import/export
  • Data masking
  • Database DevOps
  • Database documentation
  • Database modeling
  • Dependency analysis
  • Developer productivity
  • Development best practices
  • Documentation
  • Multi-DB script execution
  • MySQL data compare
  • MySQL documentation
  • MySQL schema compare
  • Object decryption
  • Object refactoring
  • Packaging and deployment
  • Schema and data scripting
  • Schema compare
  • Script comparison
  • SharePoint documentation
  • SQL formatting
  • SQL Server documentation
  • SQL source control
  • SQL unit testing
  • SSAS documentation
  • SSIS documentation
  • SSIS package compare
  • SSRS documentation
  • Statement auto complete
  • Static code analysis
  • Test data generation
  • Text and object search

sql task state

How to use and interpret the SQL Server Activity monitor

What is SQL Server Activity monitor?

Where can I see Activity monitor data?

How frequently are the Activity monitor charts refreshing in the Instance dashboard?

How can I access more detailed information about the current SQL Server activity?

How is the activity monitor data classified?

Can I see those data for a specific database of interest?

What is the SQL Server Activity monitor?

The ApexSQL Monitor activity monitor is a real-time monitoring feature that displays SQL Server processes related performance data to help to understand the impact of these processes on the monitored SQL Server instance. It combines real-time SQL Server performance data collected from various parts of SQL Server and presents it in a graphical and tabular form for easier and faster review and understanding.

In ApexSQL Monitor, the instance dashboard is the first stop where activity monitor data is presented in three charts: Waiting Tasks , Database I/O [MB/s] , Batch requests/sec .

sql task state

  • Waiting tasks – the chart displays the number of SQL Server tasks that are currently waiting for various resources such as CPU, memory or I/O
  • Database I/O  – Displays the current transfer rate when database engine reads/writes data blocks from disk into memory, from memory to a disk or from disk to disk. It is measured in Megabytes/second.
  • Batch Requests/sec – The metric reflects the SQL Server performance by displaying the number of SQL Server batches that the monitored SQL Server instance receives in one second. For more information read SQL Server performance counters (Batch Requests/sec or Transactions/sec): what to monitor and why

The charts read and display the data from the monitored instance every five seconds. The chart refresh rate is fixed and cannot be changed by the user.

While the instance dashboard displays the 3 most essential Activity monitor performance charts, for detailed activity monitor data, open the dedicated Activity monitoring page via Details link in the Activity monitor section of the instance dashboard.

sql task state

The Activity monitor page is organized in the three main performance sections: Processes , Active expensive queries, and Resource waits .

Processes – the section displays a list of all active processes that are connected and executing on the monitored SQL Server instance. The following data is displayed directly in the associated table:

  • Session ID – It is a unique number assigned to every new process when it made a connection to SQL Server
  • Wait time (ms) – displays the time in milliseconds that the particular process is waiting for one or more resources. When the process is not in the state of waiting for resources the wait time displays the 0 as a value
  • Wait type – the current or the last wait type that the particular process is forced to waits for
  • Blocked by – in case that another process blocks the monitored process, the Session ID of that blocking process displays here. In case that blocking doesn’t exist, the N/A is displayed
  • Blocker – in situations where the blocking chain exists, the session that is the head blocker for the blocking chain is displayed here. In case the actual monitoring process is the head blocker for other processes, the field displays the value of 1
  • Total CPU (ms) – a time in milliseconds that the process has spent on the CPU during the execution
  • Total physical I/O (MB) – the amount of data in megabytes that the process uses for operations of reading from, and writing to a physical disk
  • Memory use (KB) – displays the amount of memory measured in kilobytes that are being used by the process during the execution
  • State – indicates the state of the process. If the process is in the runnable or sleep state, the state will be marked as N/A. In other cases, the state can have one of the following values: Running , Suspended , or Background
  • Command – indicates the SQL command used by the process at the moment of monitoring. It can be any SQL command such as Insert, Delete, Select, Waitfor, to mention just a few

Additional monitored process details are available by expanding the process details using the expand button left of the Session Id number, which expands the table row and displays the Details tab.

sql task state

A few of the items are described below:

  • Login – The name of the SQL Server login used to run that monitored process
  • Login time – indicates the time and date when the particular user that is used to run the monitored process is logged in. It doesn’t necessarily indicate the time and date when the process is started
  • Host – displays the name of the machine (computer) from where the connection to SQL Server is made
  • Net address – the unique identifier assigned to the network interface card on the host machine. When the user logs in the Net address is assigned, and it combines MAC and IP with the port number that should ensure that required results are directed to the correct connection
  • Workload group – displays the workload group name of the Resource governor, assigned to the session that hosts the monitored process

Active expensive queries

This session display queries that perform poorly in the monitored instance.

sql task state

While some of the data displayed are already explained in the Processes section, some of the information unique to the Active expensive queries section are:

  • Elapsed time – the time in milliseconds that the query accumulated during its execution
  • Physical reads/sec – the number of physical reads that the query performs in one second. Indicates at which rate the query performs reads from the disk
  • Physical writes/sec – the number of physical writes that the query performs in one second. Indicates at which rate the query performs writes to the disk
  • Logical reads/sec – the number of logical reads that the query performs in one second. Indicates at which rate the query reads from the SQL Server database
  • Row count – the number of rows involved/processed by the query during the execution

To research in more detail, the queries that appear in the Active expensive queries section can drill down to the Single query waits page via the link in the query name in the ID column.

sql task state

Resource waits

This section provides essential information regarding the wait times in SQL Server about the key SQL Server performance-related resources like CPU, I/O, memory, network, etc.

  • Wait category – displays the wait statistic categories in which the various related wait types are logically organized.
  • Wait time (ms/sec) – the wait time measured in milliseconds per second display the wait time that all processes on monitored SQL Server that are waiting for resources of the specified wait category. It is the rate of the waiting in SQL Server at one second in the interval between the two updates
  • Average waiter count – the number of processes that are is state of waiting for resources that belong to that wait category, measured at a specific moment of sampling the data from the SQL Server
  • Cumulative wait time (sec) – the total wait time in seconds that was accumulated for a specific wait category since the last SQL Server start

Additional Resource waits details are available by expanding the wait category details via the expand button left of the Wait category name. That expands the table row and displays the Details tab where all Wait types of that wait category with accumulated wait time are listed.

sql task state

Yes. In situations where the specific database has to be tracked and analyzed, the Activity monitor allows you to filter the displayed data so that activity can be displayed only for a selected database. To do that at the top of the page next to the Refresh button, expand the Select database drop-down menu and select the database to display the performance data for.

sql task state

The data will be displayed for the selected database only until the user changes the database. To display data for the whole SQL Server again, use the “x” in the drop-down menu to remove the selected database.

sql task state

Related posts:

  • How to configure and use SQL Server Wait statistic monitoring
  • Using the query waits feature
  • How to create custom SQL Server performance reports – Part 3 (Wait statistics and Query waits)
  • How to create custom SQL Server performance reports – Part 1 (Performance and status metrics)

sql task state

What's supported

Requirements

Testimonials

Support plans

Renewals and upgrades

Resend keys

What's next

Gold Partner

  • SQL Server training
  • Write for us!

Ahmad Yaseen

Understanding different SQL Server database states

Identifying the SQL Server database state and how a database can be moved between these different states is considered an important aspect of SQL Server database administration . A good understanding of this will help us in troubleshooting and fixing many database problems and issues.

A SQL Server database state specifies the current running mode of that database. The database can be running in one state at a given time. The current state of a database can be verified by selecting the state_desc column of the sys.databases catalog view.

There are seven main states in which a SQL Server database can exit. The below SELECT statement will query the sys.databases catalog view for the name and state for all databases hosted in the current SQL Server instance:

name, state_desc  FROM sys.databases

The result, in my situation, will show that all databases hosted in the current SQL Server instance are operating in the ONLINE state as follows:

sql task state

The current state of a specific SQL Server database can be viewed also by selecting the Status property from the DATABASEPROPERTYEX function. The below SELECT statement views the current status of the SQLShackDemo database using the DATABASEPROPERTYEX function:

DATABASEPROPERTYEX (N'SQLShackDemo', N'STATUS') AS N'Status';

Which is online as shown in the result below:

sql task state

From the database availability side, the database can be fully available or fully unavailable. Between these two main states, a smooth transition should have occurred in optimal scenarios free of any problems that may interrupt that transition. In this article, we will describe the seven database states, the reasons for these SQL database states occurrences and how the database will act when operating in those states.

A SQL database that operates in an ONLINE state is available for end users access and functioning normally. In the ONLINE database state, the primary filegroup is online, although the critical database recovery process of the undo phase may still not have finished completely. The ONLINE state is the healthy state that the SQL database should move to smoothly after starting up the database.

From the Databases node of the SQL Server Management Studio, the database name e.g. SQLShackDemo with no special words between brackets, as shown below, indicates that the database is in ONLINE state

sql task state

The RESTORING database state means that the user has initiated a database restore process, using RESTORE DATABASE or RESTORE LOG T-SQL command, in which one or more data files of the Primary filegroup is restored, or one or more secondary files are being restored in offline mode. In effect thish means that the database is not available for the end user access during the restoration process.

The default database restore option is the RECOVERY option, in which the database will be brought online back after completing the database backup restoration. Using the NORECOVERY restore option, that is used to restore multiple backup files, the database will be in the RESTORING state until it reaches to the last file in which the WITH RECOVERY option is used to bring the database online again after restoring the last backup file.

The below RESTORE DATABASE command using the NORECOVERY restore option will keep the database in RESTORING state:

[master] DATABASE [SQLShackDemo] DISK = N'D:\backupSQL\SQLShackDemo_2016-08-19-001218.bak' FILE = 1,  NOUNLOAD,  STATS = 5 , NORECOVERY

The same process can be performed using the Restore Database window of the SQL Server Management Studio. The database restore option can be specified from the Options tab of that window as follows:

sql task state

Performing the previous restoration process, the database will be in the RESTORING state, with the special word “Restoring” between brackets beside the database name, as shown below, indicating that the database is in RESTORING state:

sql task state

If the database still operating in the RESTORING state and there is no backup file to be restored to the database, you can recover the database and bring it ONLINE simply by applying the below RESTORE DATABASE …. WITH RECOVERY command:

[master] DATABASE [SQLShackDemo] RECOVERY

The database will be brought online again by restoring no new page as follows:

sql task state

The Database RECOVERING state is a transient state, in which the database is performing a recovery process and will become ONLINE automatically, if the recovery process completed successfully, after the database startup.

The recovery process consists of two main phases, the Roll Forward phase, in which any transaction that is committed while shutting the database down and not yet written to the database data files will be processed. In the Rollback phase, any transaction that is uncommitted during the database shutting down will be rolled back. If the recovery process failed for any reason, the database will be moved to the SUSPECT state and will become unavailable. Working in RECOVERING state, the database will be unavailable for the users.

The special word “In Recovery”, between brackets beside the database name indicates, as shown below, that the database is in RECOVERING state:

sql task state

The RECOVERING database state is a transient state as we mentioned previously, that is performed on the database startup or after restoring the last backup file. In normal cases, the database will not be in the RECOVERING state for long time. One of the most common issues that leads the database to stay in RECOVERING state, for a longer time and slow down the recovery process, is an excessive number of Virtual Log Files (VLFs), up to tens thousands of them, inside the database transaction log. 

The number of VLFs can be verified by running the below DBCC command on your database:

SQLShackDemo LOGINFO

The command in our case will return 86 records as follows:

sql task state

This excessive number of VLFs is mainly generated due to growing the database transaction log very frequently and in very small increments. To overcome that issue, you should perform a transaction log backup on your database, shrink the transaction log as much as possible and finally specify an initial size of the transaction log file large enough to handle the database workload, without the need for frequent growth. Checking the number of VLFs again after performing the transaction log backup and the shrink operations:

The number will be decreased to 35 as in the result below:

sql task state

RECOVERY PENDING

Having your database stuck in RECOVERY PENDING state, means that the database recovery process failed, due to missing files or potentially for resource-related reasons, preventing the database from being recovered successfully, but that the database is not damaged. In this case, the database will be unavailable for the user access and required a further user action to resolve the error and let the recovery process be completed successfully.

The special word “Recovery Pending” between brackets beside the database name, as shown, indicates that the database is in a RECOVERY PENDING state:

sql task state

The SQL Server error log is the best place from which you can start your investigation. In our case, the error log shows that the database has not recovered successfully due to a database missing file that may be deleted or renamed:

sql task state

Locating the missing file again, taking the database offline and brining it online, the database will be recovered completely as shown in the error log event below:

sql task state

A database that is in the SUSPECT states means that the database is not available for user access. In this database state, the database recovery process has started but not completed successfully, requiring further user action in order to fix that issue and repair the corrupted files. SQL Server marks a database as SUSPECT due to many reasons, such as database files corruption, unavailable database files or improper shutdown of the SQL database server while running a big transaction.

Let us simulate a database corruption situation in which the SQL Server will mark the database as SUSPECT. We will create a new testing database, create a simple table in that database:

[master] CREATE DATABASE [SuspectDBDemo] USE [SuspectDBDemo] CREATE TABLE [Employees] ( [ID] INT, [FirstName]   VARCHAR (50), [LastName]    VARCHAR (50), [Address] NVARCHAR (MAX));

Moreover, we will fill that table with 1000 records using the ApexSQL Generate , synthetic test data tool as follows:

sql task state

What we will do is start a transaction that will update the testing table without committing it, and perform a CHECKPOINT command to write it to the disk.

TRAN [Employees] SET [Address] = 'AMM' WHERE [LastName] like 'Evans';

At the same time from another session, we will perform a SHUTDOWN command to terminate the SQL Server process:

WITH NOWAIT;

After that, we will open the database log file using any hex editor, and modify the first section by filling it with zeros and save the file again as below:

sql task state

Finally, we will start the SQL Server service again. If you try to run any simple query on that database, an error showing that the database is inaccessible will be displayed as follows:

sql task state

Checking the database state using the DATABASEPROPERTYEX function:

DATABASEPROPERTYEX ('SuspectDBDemo', 'STATUS') AS DatabaseStatus

The result will show that the database is in SUSPECT state:

sql task state

The special word, “Suspect” between brackets beside the database name, as shown below, indicates that the database is in SUSPECT state:

sql task state

Again, and always, referring to the SQL Server error log will help you finding the root cause of the database SUSPECT issue, which is an issue with the log file in our case as follows:

sql task state

The database can be changed to the EMERGENCY state by a sysadmin user action, in order to safely perform database maintenance or for troubleshooting purposes. In this state, the database will be in single-user mode to be repaired or restored, marked as READ_ONLY where you can export the data out of the database, logging is disabled and the access is restricted only to the sysadmin role members.

Let us get back again to the previous SuspectDBDemo corrupted database that is marked as SUSPECT. In order to troubleshoot its problem and resolve it, we will change the database state to EMERGENCY, permitting the sysadmin users read-only access to that database. The below ALTER DATABASE statement is used to set the database state to EMERGENCY:

DATABASE SuspectDBDemo SET EMERGENCY

The special word “Emergency” between brackets beside the database name, as shown below, indicates that the database is in EMERGENCY state:

sql task state

Having the database in EMERGENCY state, we can work on resolving the problem safely. In order to check for database corruption, a DBCC CHECKDB command can be executed while the database in EMERGENCY state. Before doing that, the database should be changed explicitly to run using SINGLE_USER mode using the below ALTER DATABASE command:

DATABASE SuspectDBDemo SET SINGLE_USER WITH ROLLBACK IMMEDIATE

The DBCC CHECKDB command can be executed now on that database, with the REPAIR_ALLOW_DATA_LOSS option. Damaged data and/or indexes may be removed to make the database physically consistent, but with possible data loss. In addition, the transaction log file will be rebuilt if there is any problem with that transaction log. The below DBCC CHECKDB command is used to fix the database corruption:

CHECKDB (SuspectDBDemo, REPAIR_ALLOW_DATA_LOSS)

The clear DBCC CHECKDB command result in our case will be as follows:

sql task state

Changing the database running mode back to MULTI_USER mode:

DATABASE SuspectDBDemo SET MULTI_USER WITH ROLLBACK IMMEDIATE

The database transaction log file corruption issue is resolved now, after rebuilding the log file, and the database is ONLINE again and available for the user access:

sql task state

If you run a simple SELECT statement from the database table, the data will be retrieved with no issue:

sql task state

When the database is in OFFLINE state, the database is not functioning nor unavailable for the user access. The database state can be changed to or from OFFLINE state only by an explicit user action. Setting the database state to OFFLINE helps in migrating the database files to a new disk drive, or preventing the users from reaching it for any reason. The below ALTER DATABASE statement is used to change the database state to OFFLINE:

DATABASE [MDW] SET OFFLINE

The same action can be performed using the SQL Server Management Studio, right-clicking on the database -> Tasks and choose Take Offline task as follows:

sql task state

The red arrow and the Offline special word between brackets beside the database name indicates that the database is in OFFLINE state as follows:

sql task state

Taking into consideration that the database will stay offline unless you perform an explicit action to bring it online. The below ALTER DATABASE statement will bring the database online back:

DATABASE [MDW] SET ONLINE

Bringing the database online using the SQL Server Management Studio can be performed by, right-clicking on the database -> Tasks and choose Bring Online task:

sql task state

In this article, we’ve described seven different states of a SQL Server database, showed how a database operated in these states and how to move the database from one state to another.

Changing the database state is critical and you should make sure that this change is performed at the right time, in a correct situation, and that you have the recovery plan in the case of failure.

  • Recent Posts

Ahmad Yaseen

  • Azure Data Factory Interview Questions and Answers - February 11, 2021
  • How to monitor Azure Data Factory - January 15, 2021
  • Using Source Control in Azure Data Factory - January 12, 2021

Related posts:

  • How to Rebuild a Database with a Corrupted or Deleted SQL Server Transaction Log File
  • Understanding Database snapshots vs Database backups in SQL Server
  • Restoring a SQL Server FILESTREAM enabled database
  • Understanding Database Backup Encryption in SQL Server
  • 10 most important SQL Server transaction log myths

What are you looking for?

Popular Topics

Utilizing SQL Server, Part 1: Using Activity Monitor

warren-wong-323107-unsplash-1

We take a look at the valuable data that SQL Server Activity Monitor can provide when managing your SQL Server instance.

For people that do not work with SQL Server every day, finding out what is going on in their SQL Server instances can sometimes be a challenge. Fortunately, SQL Server has a number of built-in tools that can make this job a lot easier. This blog will be the first in a series that will explore a few of these SQL Server tools and give some insight into the data they can provide us.

There are many reasons why someone would want to get a better understanding of what their SQL Server instance is doing. The most common one we deal with here at Diagram is probably poor front-end application performance, such as a slow web site or application. When looking into something like a slow application, I always recommend looking at the both the machine serving up the application and the database server supporting it (if there is one). If that back-end database is SQL Server, then the place to start is with SQL Server Management Studio’s Activity Monitor tool .

Activity Monitor allows the user to get a graphical overview of what the SQL Server instance is doing, and it also allows the user to dig a little deeper into some of the wait statistics and recently run queries.  We’ll go over the five main sections of Activity Monitor and the kind of information each section can provide the user.

Note: The current form of the SQL Server Management Studio’s Activity Monitor tool was first released with SQL Server 2008, so information presented here only applies to SQL Server 2008 Management Studio and versions following that release.

Getting Started

To open Activity Monitor, you first need be in SQL Server Management Studio and connected to the SQL Server instance you want to investigate. Within Management Studio, simply click on the Activity Monitor icon in the standard tool bar:

Activity_Monitor_icon.jpg

You can also right click on the SQL Server instance name and select Activity Monitor:

Activity_Monitor_Right_Click.png

Activity Monitor will then load in the right hand panel, and you will start receiving real time data on the selected SQL Server instance.

At the top of the Activity Monitor panel will be the Overview section. This pane allows you to see how the instance is performing at a glance. Overview give you a graphical display of the following:

  • Percent Processor Time - The percentage of elapsed time that the processor spends to execute non-idle threads for the instance across all CPUs.
  • Waiting Tasks - The number of tasks that are waiting for processor, I/O, or memory resources.
  • Database I/O - The transfer rate, in megabytes per second, of data from memory to disk, disk to memory, or disk to disk.
  • Batch Requests/sec - The number of SQL Server batches that are received by the instance.

AM_Overview.png

The next section down is Processes. This pane shows a list of all the active users who are connected to the SQL Server instance. It has the following columns: 

  • Session ID - A unique number that is assigned to each user connection when the connection is made.
  • User Process - Displays 0 for a system process and 1 for a user process. By default, the filter setting for this column is 1. This displays only user processes.
  • Login - The SQL Server login name under which the session is currently executing.
  • Database - The name of the database that is included in the connection properties of processes that are currently running.
  • Task State - The state of the task. For tasks in a runnable or sleeping state, the task state is blank. Otherwise, this can be one of the following values: Background, Running, or Suspended.
  • Command - The kind of command that is being processed under the task.
  • Application - The name of the application program that created the connection.
  • Wait Time (ms) - The time, in milliseconds, in which this task is waiting for a resource. When the task is not waiting, the wait time is 0.
  • Wait Type - The name of the last or current wait type.
  • Wait Resource - The name of the resource that is needed.
  • Blocked By - If there are blocking sessions, the ID of the session that is blocking the task.
  • Head Blocker - If there are blocking sessions, identifies the session that causes the first blocking condition. A value of 1 represents a head blocker for other sessions.
  • Memory Use (KB) - The amount of memory, in kilobytes, that is being used by the task.
  • Host Name - The name of the computer that made the connection to the instance of SQL Server.
  • Workload Group - The name of the Resource Governor workload group for the session.

You can right click any of the Session IDs and run a SQL Server Profiler Trace to capture all its activities or you can see the Session Details. You can even KILL a process. We will be going over these items in a future blog post.

AM_Processes.png

Resource Waits

The Resource Waits pane provides valuable information with respect to SQL Server wait times and counts for key resources related to the performance of the instance. This helps identify potential bottlenecks with respect to Memory, CPU, Network I/O, etc. The columns in this pane are: 

  • Wait Category - The categories that accumulate wait type statistics. The individual wait types are shown in the Active User Tasks pane.
  • Wait Time (ms/sec) - The wait time in milliseconds per second for all tasks that are waiting for one or more resources in the wait category since the last update interval.
  • Recent Wait Time (ms/sec) - The weighted average wait time in milliseconds per second for all tasks that are waiting for one or more resources in the wait category since the last update interval.
  • Average Waiter Count - The number of tasks that are waiting for one or more resources in the wait category at a typical moment during the last sample interval.
  • Cumulative Wait Time (sec) - The total amount of time in seconds that tasks have waited for one or more resources in the wait category since SQL Server was last started on the instance.

AM_Resource_Waits.png

Data File I/O

The forth pane down is Data File I/O. This provides disk level I/O (input/output) information related to all the data and log files of user and system databases. This information can be used to quickly identify databases which are performing badly due to disk bottlenecks. The columns in the Data File I/O pane are:

  • Database - The name of the database.
  • File Name - The name of the files that belong to the database.
  • MB/sec Read - Recent read activity, in megabytes per second, for the database file.
  • MB/sec Written - Recent write activity, in megabytes per second, for the database file.
  • Response Time (ms) - Average response time, in milliseconds, of recent read-and-write activity to the database file.

AM_Data_File_IO.png

Recent Expensive Queries

At the bottom is the Recent Expensive Queries pane. This allows you to identify poorly performing queries in an instance. You can also right click any of the queries and choose the "Edit Query Text" option to edit the query. Right clicking also lets you see the execution plan of a query by selecting the option "Show Execution Plan". The columns for this pane are:

  • Query - The query statement that is being monitored.
  • Executions/min – The number of executions per minute for the query.
  • CPU (ms/sec) - The rate of CPU use by the query.
  • Physical Reads/sec - The rate per second of physical reads by the query.
  • Logical Writes/sec - The rate per second of logical writes by the query.
  • Logical Reads/sec - The rate per second of logical reads by the query.
  • Average Duration (ms) – The average duration in milliseconds of running this query.
  • Plan Count - The number of cached query plans for this query.

AM_Recent_Expensive_Queries.png

By using Activity Monitor and having a good understanding of the data it is providing us, we can get a better understanding of what’s going on in real time with respect to a SQL Server instance. With this data, we can start to dig into the root causes of many database related performance issues we may be seeing in our front-end application. With this need to dig deeper in mind, in the next installment of this series, we will look at expensive queries and get a better understanding of SQL Server execution plans.

If you have any questions about using Activity Monitor, or if you have any tips of your own for how to get the most out of this tool, please feel free to share them in the comments below. If you want to know more about Diagram’s hosting services, please contact us . Thanks for reading, and we hope you join us for the next installment in this blog series!

Have questions or comments about this post? We'd love to hear from you.

Related posts.

The 3 Main Types of SSL Certificates to Know

The 3 Main Types of SSL Certificates to Know

Learn about the 3 main types of SSL certificates to help you decide which one is best for your business.

Why Do I Need an SSL Certificate?

Why Do I Need an SSL Certificate?

Without understanding what an SSL Certificate is, it may be hard to realize why this is so important for your website. In this blog Diagram will cover both of these topics.

Results Matter.

We design creative digital solutions that grow your business, strengthen your brand and engage your audience. Our team blends creativity with insights, analytics and technology to deliver beauty, function, accessibility and most of all, ROI. Do you have a project you want to discuss?

Let's Talk

Like what you read?

Subscribe to our blog "Diagram Views" for the latest trends in web design, inbound marketing and mobile strategy.

Greg's Ramblings

SQL, Programming and IT Life

Runnable, Running and Suspended

When you send a query to SQL to be executed, the query is compiled and then run. When you have 1 person querying the database, everything runs fine, but when you ramp that up to multiple users, you start to fight for resources. One of those resources is CPU.

To manage CPU time, SQL Server tracks tasks in 3 basic states – Runnable, Running and Suspended.

Runnable: This is the default state of a new task that comes to SQL. Runnable means that it is ready to run, it has all the info it needs, and it’s just waiting for the CPU to be free. All of the tasks in a runnable state are queued up and taken in order to be run.

Running: This is the state when the task is being run by the CPU. SQL Server is actually doing the work that the query has asked. There are 3 normal ways that a task can stop being running:

  • It completes
  • It has to wait on another resource (like reading data from disk)
  • It has been running for 4ms

Suspended: This is the state when your task has been removed from the running state, either because it’s 4ms is up or it is waiting for a resource other than CPU. It might be waiting on Locks, Disk IO, Network Traffic, Synchronous Commits in an availability group, or a huge range of other things. Once it has finished waiting, the task will be sent back to the Runnable queue, to wait for some more CPU time.

sql task state

One of the biggest takeaways for me when I first learnt about this, was that the task is only running for 4ms at a time. Your task cannot tell SQL that it needs more time, it cannot tell SQL to just hang on for another couple of milliseconds because I’m almost done.

As you start to look in to making your server perform better, understanding the different states of tasks becomes important so you know where to look. Do you have a million tasks in the runnable state? You might need more CPU. Do you have an empty queue in the runnable state? You might need less CPU (less licenses/cloud resources). Do you have a heap of tasks in the suspended state? You might want to look at what is holding up those queries, throwing CPU at your server might not be the solution.

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
  • Click to share on Pinterest (Opens in new window)

' src=

how about Sleeping status?

' src=

Sleeping is a bit different – it usually means the command has completed on the server and the data (if any) has been returned to the client, so SQL Server is just waiting for another command or for the client to close the connection.

Leave a Reply

Notify me of follow-up comments by email.

Notify me of new posts by email.

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Suspended in index rebuild

In SQL Server 2012, an Index Rebuild job is taking a very long time (up to 8 hours). However, not even one Index rebuild completed, so I stopped the index job.

In monitoring SQL task:

Thanks in advance for any helpful info.

  • sql-server-2012

András Váczi's user avatar

  • 5 LCK_M_SCH_M means something has a schema lock that is blocking your process. If you run sp_who2 , you should see a blocking process that is preventing the index rebuild from proceeding. –  Mike Fal Commented Apr 12, 2013 at 2:58
  • 1 @amin: Any news for this? have you seen the comment and the answers? –  Marian Commented May 17, 2013 at 13:26

2 Answers 2

The reason that your index rebuild isn't completing is because of the LCK_M_SCH_M wait type. What happens when you try to rebuild an index, a Sch-M lock is requested on the object that you're trying to rebuild.

Please see this below chart for lock compatibility :

As you can see here, a Sch-M lock has a conflict with almost every locking scenario (shared, exclusive, update, schema stability, etc.).

Here's a small example showing what may be happening in your environment. To create the test object in a test database:

Now if one session is executing a query, and it keeps the lock open (I'm using an update query and not committing the transaction):

And if another session attempts to rebuild the clustered index on that table:

It's going to be blocked by the initial UPDATE query. We can see this through a little diagnostic query below:

My output looks like the following:

enter image description here

As you can see here, my ALTER INDEX ... REBUILD command is being blocked by the UPDATE query. The request lock is the Sch-M lock that is required on the OBJECT in order for this operation to complete.

Due to this concurrency conflict, it is advisable to schedule your index maintenance (as well as other maintenance tasks) during a window where there is little to no user load.

Thomas Stringer's user avatar

  • This is a good answer and a great example! +1 –  Marian Commented May 17, 2013 at 13:12
  • I know this is so old but I am stuck with an Alter Index Rebuild like this. I have had an Alter Index Rebuild running for 6+ hours. and the status of the Alter Index process is “suspended”. It also has a wait type of LCK_M_SCH_M and it appears there are 100 or so other processes being blocked by the SPID of the Rebuild. Is there a way to abort the Rebuild or will it eventually finish? I cant tell if its even doing anything. by the way the database is ~40GB. –  Christopher Commented May 13, 2023 at 1:32

We typically time our larger index maintenance operations to take place in midnight when there's minimal business-use. Without knowing the business-critical constraints on the task, you might want to force the database into single_user mode in case there are too many non-critical queries being run against the database during the maintenance period. Assuming this won't cause other problems of course, depends on the system as a whole.

Kahn's user avatar

Your Answer

Reminder: Answers generated by artificial intelligence tools are not allowed on Database Administrators Stack Exchange. Learn more

Sign up or log in

Post as a guest.

Required, but never shown

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy .

Not the answer you're looking for? Browse other questions tagged sql-server index sql-server-2012 or ask your own question .

  • Featured on Meta
  • Upcoming sign-up experiments related to tags

Hot Network Questions

  • Why can't LaTeX (seem to?) Support Arbitrary Text Sizes?
  • Google Search Console reports "Page with redirect" as "errors", are they?
  • Rear shifter cable wont stay in anything but the highest gear
  • What actual purpose do accent characters in ISO-8859-1 and Windows 1252 serve?
  • How do guitarists remember what note each string represents when fretting?
  • Visit USA via land border for French citizen
  • What type of black color text for brochure print in CMYK?
  • What is the translation of misgendering in French?
  • Are both vocal cord and vocal chord correct?
  • Can I route audio from a macOS Safari PWA to specific speakers, different from my system default?
  • DSP Puzzle: Advanced Signal Forensics
  • What is the original source of this Sigurimi logo?
  • À + infinitive at start of sentence
  • How to Pick Out Strings of a Specified Length
  • Are there paintings with Adam and Eve in paradise with the snake with legs?
  • Is the zero vector necessary to do quantum mechanics?
  • Sets of algebraic integers whose differences are units
  • How can a landlord receive rent in cash using western union
  • Folk stories and notions in mathematics that are likely false, inaccurate, apocryphal, or poorly founded?
  • How to make D&D easier for kids?
  • Old book about a man who finds an abandoned house with a portal to another world
  • What kind of sequence is between an arithmetic and a geometric sequence?
  • Navigation on Mars without Martian GPS
  • Simple Container Class

sql task state

iheavy logo

How to Extract Values from a Nested JSON Field in SQL Server

SQL Server provides robust support for JSON, making it easier to store, query, and manipulate JSON data within your database. One common task is extracting values from nested JSON fields. This article will guide you through the process of extracting values from a nested JSON field in SQL Server, complete with example queries and explanations.

How to Extract Values from a Nested JSON Field in SQL Server

Understanding JSON Functions in SQL Server

Sql server includes several built-in functions to work with json data:.

Parses JSON text and returns objects and properties as rows.

Extracts a scalar value from a JSON string.

Extracts an object or an array from a JSON string.

JSON_MODIFY

Updates the value of a property in a JSON string and returns the updated JSON string.

Example JSON Structure

Consider the following JSON structure stored in a column named JsonData in a table called JsonTable:

Extracting Values from Nested JSON Fields

Extracting scalar values.

To extract scalar values from a JSON field, use the JSON_VALUE function. For example, to extract the city from the address field:

Extracting Objects and Arrays

To extract an entire object or array, use the JSON_QUERY function. For example, to extract the address object:

Extracting Values from Nested Arrays

To extract values from nested arrays, use the OPENJSON function. For example, to extract all order details:

Putting It All Together

Combining these functions, you can extract and manipulate nested JSON data effectively. Here is an example query that extracts multiple fields from the JSON structure:

Frequently Asked Questions

Can i update a nested json field in sql server.

Yes, you can use the JSON_MODIFY function to update a nested JSON field. For example, to update the city in the address field:

How do I handle missing or null values in JSON?

Use the ISNULL or COALESCE functions to handle missing or null values. For example, to handle a missing state value:

Can I index JSON fields in SQL Server?

Yes, you can create computed columns based on JSON values and index those columns to improve query performance. For example:

Extracting values from nested JSON fields in SQL Server is straightforward with the built-in JSON functions. By using JSON_VALUE, JSON_QUERY, and OPENJSON, you can efficiently query and manipulate JSON data stored in your database. Understanding these functions and their applications will enable you to work effectively with JSON data in SQL Server.

Similar Posts

Export Database Diagram SQL Server to image

Export Database Diagram SQL Server to image

Database diagrams in SQL Server are invaluable visual representations of database structures, relationships, and entities. Often, users need to export these diagrams to images for documentation, presentations, or sharing purposes. While SQL Server Management Studio (SSMS) provides a native tool for creating database diagrams, exporting them to images requires additional steps.  In this article, we…

How to Drop a Constraint in SQL | Easy Methods

How to Drop a Constraint in SQL | Easy Methods

In SQL, constraints are rules applied to table columns to enforce data integrity and ensure the accuracy and reliability of the data within the database. However, there are situations where you may need to drop a constraint, such as when modifying the schema, fixing data issues, or changing business requirements.  This article will guide you…

SSRS Login Failed for User NT AUTHORITY ANONYMOUS LOGON | Solved

SSRS Login Failed for User NT AUTHORITY ANONYMOUS LOGON | Solved

Encountering a “Login failed for user ‘NT AUTHORITY\ANONYMOUS LOGON’” error while working with SQL Server Reporting Services (SSRS) can be nerve-racking. This issue typically arises when using Windows Integrated Security for data source connections.  In this article, we’ll try to find out the possible causes of this error and also explore solutions to help you…

How Do I Convert Month Number to Month Name

How Do I Convert Month Number to Month Name

In database management, it’s often crucial to present data in a human-readable format. One common requirement is to convert month numbers into month names for better comprehension and analysis.  Whether you’re dealing with financial reports, scheduling tasks, or analyzing trends over time, having the ability to translate month numbers to names can significantly enhance the…

DB2 SQL Error SQLCODE=-803: Integrity Constraint Violation

DB2 SQL Error SQLCODE=-803: Integrity Constraint Violation

DB2, a popular relational database management system, provides robust features for data integrity. But, there are instances where you may encounter an SQL error with the SQLCODE=-803.  This error typically indicates an integrity constraint violation, where a value being inserted or updated violates a constraint defined on the table. In this article, we will explore…

Conversion Failed When Converting the varchar Value to Data Type int | Solved

Conversion Failed When Converting the varchar Value to Data Type int | Solved

When encountering the error message “conversion failed when converting the varchar value to data type int,” it’s typically an indication that there’s an attempt to convert a string (varchar) value into an integer (int) type, but the conversion process has failed due to incompatible data types.  This error often arises in SQL queries, especially when…

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Save my name, email, and website in this browser for the next time I comment.

sql task state

sql task state

Publish task lists to define and track work in your organization

Your browser does not support video. Install Microsoft Silverlight, Adobe Flash Player, or Internet Explorer 9.

As an operations manager or similar business leader, you can centrally create a list of tasks for many teams in your org and monitor for completion of work. This feature is designed to make task management easier for organizations with frontline workers distributed across many different geographic locations.

This capability is available to you in the Planner app in Microsoft Teams if your organization  enabled task publishing for you and your team.  

In this article

Before you get started

Create a publishable task list

Make changes to a list that hasn't been published yet

Publish a task list

Make changes to a published task list

View reporting for published tasks

With task publishing, your organization can centrally define tasks and distribute them to the teams who must perform the work. If enabled for you by your organization , you’ll find this functionality in the Planner app in Microsoft Teams.

In the task publishing experience, you start with a task list, which you can add tasks to. You have control over the details for each task in a list so you can add notes, set the priority, attach documents and photos, or apply requirements for completion. When you add at least one task to a task list, you can publish that list to the teams (locations) that you choose. After publishing a list, you’ll see a reporting view that reflects completion status of the work across locations, and:  

Frontline workers can see all tasks assigned to them in the Planner app in Teams on mobile, desktop, and web.

Frontline managers can use Planner to track task progress and completion for their locations.

Organization leaders can use Planner to see task progress across all locations.

Frontline workers and managers won’t be able to delete the tasks published to their team. The title, notes field, and checklist item fields are also protected for published tasks, so frontline employees can't change the details of the work.

Screenshot showing the Publishing page in the Planner app.

Important:  You'll only see the Publishing page if your organization enabled task publishing by uploading a hierarchy and you're a member of a team in that hierarchy. If publishing is available for you, the Publishing page allows you to broadly publish to teams you're not a member of. The My Tasks & Plans page shows your individual tasks for yourself and the tasks you're working on directly with teammates (in your teams and channels). Plans in My Tasks & Plans can't be published.

Before you get started 

Learn about the types of lists you can create and publish .

There are two types of task lists in task publishing. You can create lists with tasks for each team  (known as standard task lists) and lists with tasks  for each team member . Here’s more information about each type of list and when to use them.

List

When to use

Behavior when published

Example



For tasks that need to completed once per team.

You can make these lists recurring.

For each team selected, a copy of the task is created in a plan for that team.

As soon as one frontline manager or worker completes the task, it’s considered completed for the whole team.

Reza, the operations manager at a manufacturing org, creates a task list for implementing a new production line. Reza publishes that list to the set of plant locations meant to pilot the new line.

Each selected location receives one copy of the task. When any manager or worker there marks the task complete, it reflects as completed for the entire location.



For tasks that everyone on the team must complete.

For each team selected, copies of the task are created. For every member of the team, a copy of each task is created in a personal plan for that team member, and the task is assigned to that individual.

All team members must complete the task for their location to reflect 100% completion of that task.

Camille, the operations manager in a retail org, has a new workplace health policy that all employees must acknowledge. Camille publishes a task list with a task for reviewing and signing off on the new policy.

Every employee at each selected location sees a task created for and assigned to them. Each employee must complete their own task. When a user marks their task complete, it won’t affect the tasks assigned to their teammates.

Get familiar with the Publishing page

Screenshot showing the Drafts, Scheduled, Published, and Unpublished sections of the Publishing page of the Planner app.

Section

List state and behaviors

Can tasks in the list be edited?

Are tasks visible to members of the recipient team?

Drafts

Not yet published or scheduled for publication.

Yes

No

Scheduled

Scheduled to publish at a specified day and time.

Yes

No

Published

The list is published, or publishing is in progress.

Yes

Yes

Unpublished

The list is unpublished, or unpublishing is in progress.

No

No

Note:   Some users will also see a Received section where they see lists published to their team by teams higher up in the hierarchy. Most publishing users won’t see this section.

Create a new task list

Screenshot showing options for creating a new publishable task list.

For each team .   Use for tasks that need to be completed once per team, also referred to as a standard task list.

For each team member . Use for tasks that everyone on the team must complete, such as training or policy acknowledgement tasks.

Important:  After you create a list with tasks for each team , you can’t change it to a list for each team member and vice versa. You’ll need to create a new list.

Name your list.

If you belong to more than one team that can publish, select the team to publish from. The teams that receive the task list publication will be able to see which team the task list was published from.

Select  Create . The new list appears under  Drafts .

Under  Task title , give the first task a title, and select Enter .

Select the task title to open the task and add or edit any of the following.   

Bucket. Use to categorize tasks. For example,  Warehouse  or  Sales Desk  buckets could be used to identify the work group who will perform the task.

Priority. Options are Urgent, Important, Medium, and Low.

Start date or due date

A checklist of up to 20 items. You control the items, order, and whether the  checklist is required for task completion . Task recipients control marking each item complete. 

An attachment 

Requirements for task completion. Task recipients must complete the requirements before they can mark the task complete. To learn more, see Set requirements for task completion in a task list . 

Required form : Link up to two forms that task recipients must fill out. You can create a new form or use an existing form.

Required approval : Add an approval requirement for task recipients to request and receive approval from a manager. This is only available for tasks lists created using the For each team option (also known as standard task lists). 

To add another task, enter a task name in the  New task  field.

Tip:  After you create tasks, you can bulk edit the priority, due date, or bucket for all the selected tasks. 

 If you created your list using the For each team option (also known as a standard task list), you can make it recurring so that it automatically publishes on a repeating schedule. To do so, select Does not repeat , choose the recurrence settings for the list, and then select Save . To learn more about working with recurring task lists, see Use recurring task lists . 

Duplicate a task list

You can create a copy of any task list using the Duplicate action. This action creates a new list with a copy of the tasks in the original list. You can choose the name of the new list and which team it should be created for. Then, you can edit the tasks in the new list to prepare it for publishing.

More options button

Name the list and select the Publish from team. If you belong to more than one team in your organization’s hierarchy, you'll see multiple choices. The teams that receive the task list publication will be able to see which team the task list was published from.

Select Duplicate . After the list is duplicated, it appears under Drafts . You can interact with the list just like other draft lists.  

Make changes to a task list that hasn't been published yet 

Edit tasks in a draft or scheduled list.

Under  Drafts or Scheduled , select the task list you want to edit. 

To change a task, select its title to open the task, and then do one of the following:

To change any of the task's fields, select the field and edit as needed. You can also add or remove attachments and requirements.  

Rename a list

You can rename a draft list before you publish it. 

Enter the new name in the Title box, and then select Save .

Delete a task list from Drafts or Unpublished

Important:  You can't delete a list in the Published state or a recurring list series in the Scheduled state. You must first unpublish the list or cancel the list series and then unpublish it, which deletes all tasks in the list or lists from all recipient teams. After unpublishing the list or list series, it appears under  Unpublished.

You can delete any task list under Drafts  or  Unpublished .

Under Drafts or Unpublished , go to the task list you want to delete.

Publish a task list 

Publish a task list .

When your task list is ready to go, publish it to the teams whose members will do the work. 

Note:  After you publish a list, you can  make changes to the tasks but you can't make changes to the teams selected to receive those tasks.

Under  Drafts , select a task list, and then in the upper-right corner, select  Publish  or Publish series (if it's a recurring task list ). 

Choose how to select the recipient teams. You can select the teams from a hierarchy or upload a custom list of teams. Learn more about these options . The following steps show selection from a hierarchy.

Dialog for choosing who receives the published task list

To select all the teams within a branch of the hierarchy, select the check box next to it. For example, selecting "North America" selects all the locations in that region. 

To publish to only locations with certain attributes, select a filter. For example, to select all locations with a large layout, select the "Large" filter. In the example image, the task list will be published to all large stores in North America.

Choose whether to notify recipient teams.

Select  Next , and then review your publication plan. To make changes, select  Back .  

Select the  Ready, everything looks good here check box, and then choose  Publish . 

As soon as the publishing process begins, the task list moves from Drafts to Published to indicate that tasks are being sent and becoming visible to recipients. 

Task publishing can take a little while if there are a large number of tasks in your task list or if you select a large number of recipient teams. It’s okay to leave the publishing screen and come back later— the tasks will continue publishing in the background. 

When publishing is done, you'll see a message at the top of the  Publishing page indicating your tasks were successfully delivered.

Important:  If alert icons appear, select  View details  to help resolve the issues.

Edit tasks in a published list

You can edit tasks in a published list by putting the list into edit mode. When the list is in edit mode, you can update tasks in the list, delete tasks from the list, or add new tasks to the list. Changes aren't published to recipient teams until you select the  Publish changes  and confirm the summary. 

When you publish changes to a task in a published list, the values in the task fields in the updated task will overwrite the values of those task fields in each recipient team, with the exception that the status of the task isn’t reset. For this reason, we recommend editing a task in a published list when you want to clarify what needs to be done. If there's a correction that requires the task to be completed again even if it was completed per the previous task details, we recommend deleting the original task and creating a new one.

Under  Published , select the list you want to edit, and then choose Edit list .

When you're ready to publish the changes, select Publish changes in the upper-right corner to publish the changes to all the original recipient teams.   Alternatively, you can choose to cancel the edits you made, and the list will revert back to its previously published state.

Unpublish a list 

Caution:  Unpublishing a task list removes all tasks in the list from all teams that received them. They will lose all comments and any attachments they added.

If you need to unpublish a task list, it's best to do so as soon as possible to reduce the assignment and completion of tasks that are wiped out. An unpublished list moves to the Unpublished  section and can be duplicated but can't itself be republished.   

Confirm you want to unpublish the list, and then choose Unpublis h.

After the list appears under  Unpublished , you can delete it or duplicate it, edit the copy, and publish the edited copy.

 View reporting for published tasks

Track assignment and completion of published tasks.

After you publish a task list, you'll likely want to track teams' progress in assigning and/or completing the tasks you sent them. Select a list in the Published section. From here, you can view details for the published tasks in a few different ways. 

Note:  Users in your organization can view reporting for any team they're a part of. For example, a user who is part of the Store 100 team can view reporting for that location. A user who is part of Region 1 can see reporting for all locations reporting up to Region 1 in the hierarchy.

Screenshot of the Task report view for a published task list.

In either view, you can select any branch of the hierarchy to expand it or select any team to see the status for that specific team. To return to a high-level view after looking at the details, select the task list name that appears above the team name.

Note:  Everyone to complete lists (lists created using the For each team member option) show the reports in a slightly different presentation. These tasks are automatically assigned at creation time, so the report focuses on completion status. 

Facebook

Need more help?

Want more options.

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

sql task state

Microsoft 365 subscription benefits

sql task state

Microsoft 365 training

sql task state

Microsoft security

sql task state

Accessibility center

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

sql task state

Ask the Microsoft Community

sql task state

Microsoft Tech Community

sql task state

Windows Insiders

Microsoft 365 Insiders

Was this information helpful?

Thank you for your feedback.

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Task Manager State Enum

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Enumerates the current state of TaskManagerState .

Cancelled 4

Specifies that is in cancelled state.

Performed 5

Specifies that is in performed state.

Performing 3

Specifies that is in performing state.

Ready 0

Specifies that is in ready state.

Validated 2

Specifies that is in validated state.

Validating 1

States that is in validating state.

Additional resources

  • Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers
  • Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand
  • OverflowAI GenAI features for Teams
  • OverflowAPI Train & fine-tune LLMs
  • Labs The future of collective knowledge sharing
  • About the company Visit the blog

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Get early access and see previews of new features.

SQL Server process Task state Suspended and Read Timeout

I am running parallelly multiple queries in a SQL Server. All of them is simple select statement without any filter/group by condition. Queries are running through Talend ETL tool. When I check the Activity Monitor, lot of processes are in Suspended state. And I am facing Read Timeout , when one query/job gets this error, all the other queries/jobs fails due to this. My questions is

  • Is there way to reduce the number of processes in Suspended State at a time?
  • How to avoid the Read Timeout error and how to make other queries executing in parallel run without any issue?
  • Fetching data takes more than an hour for some tables. How to reduce this time?
  • sql-server-2012
  • timeoutexception

Rathesh's user avatar

  • First thing: stop running them in parallel. If they are IO-bound (and they usually are) then you are not speeding them up by running them in parallel. For better help we need to see queries, tables, indexes, and query plans (you can share those via brentozar.com/pastetheplan –  Charlieface Commented Oct 21, 2021 at 19:32
  • There are simple select queries without any filter/group by condition and it fetches all the records from the table. –  Rathesh Commented Oct 22, 2021 at 2:19
  • If they are simple and run quickly why do you need to run them in parallel? Clearly the server is getting overloaded and suspending some queries in favor of others. Have you checked there is nothing else running at the same time, such as a backup job or maintenance job? –  Charlieface Commented Oct 22, 2021 at 4:10
  • Just to clarify, it is simple select query but it is not running quickly. I am reading millions of records. Reason I am running in parallel is to reduce the run time. 90% of the jobs are running in parallel, but it still took 8 to 9 hrs to complete. I want to reduce this time. –  Rathesh Commented Oct 22, 2021 at 5:56

Know someone who can answer? Share a link to this question via email , Twitter , or Facebook .

Your answer.

Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more

Sign up or log in

Post as a guest.

Required, but never shown

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy .

Browse other questions tagged sql sql-server-2012 etl talend timeoutexception or ask your own question .

  • Featured on Meta
  • Upcoming sign-up experiments related to tags
  • Policy: Generative AI (e.g., ChatGPT) is banned
  • The [lib] tag is being burninated
  • What makes a homepage useful for logged-in users

Hot Network Questions

  • Can I get a refund for ICE due to cancelled regional bus service?
  • Where can I access records of the 1947 Superman copyright trial?
  • How can I take apart a bookshelf?
  • In By His Bootstraps (Heinlein) why is Hitler's name Schickelgruber?
  • Would the category of directed sets be better behaved with the empty set included, or excluded?
  • How to determine if gravity is roughly linear?
  • How do guitarists remember what note each string represents when fretting?
  • Is arxiv strictly for new stuff?
  • How to make D&D easier for kids?
  • What type of black color text for brochure print in CMYK?
  • What is the original source of this Sigurimi logo?
  • How can I confirm for sure that a CVE has been mitigated on a RHEL system?
  • Does "*some of the town council*" mean the same as "*some of the **members** of the town council*"?
  • Is there a way to non-destructively test whether an Ethernet cable is pure copper or copper-clad aluminum (CCA)?
  • Is Légal’s reported “psychological trick” considered fair play or unacceptable conduct under FIDE rules?
  • What could explain that small planes near an airport are perceived as harassing homeowners?
  • Is the FOCAL syntax for Alphanumeric Numbers ("0XYZ") documented anywhere?
  • What is the meaning of '"It's nart'ral" in "Pollyanna" by Eleanor H. Porter?
  • Less ridiculous way to prove that an Ascii character compares equal with itself in Coq
  • Old book about a man who finds an abandoned house with a portal to another world
  • Trying to determine what this small glass-enclosed item is
  • Can I tell a MILP solver to prefer solutions with fewer fractions?
  • Is there any other reason to stockpile minerals aside preparing for war?
  • Do I need to indicate 'solo' for wind/brass instruments in shared staff?

sql task state

IMAGES

  1. SQL Statement task :: Loome Integrate Documentation

    sql task state

  2. Task state diagram.

    sql task state

  3. Execute SQL Task in SSIS: SqlStatementSource Expressions vs Variable

    sql task state

  4. Execute SQL Task in SQL Server Integration Services SSIS

    sql task state

  5. Execute SQL Task in SSIS: SqlStatementSource Expressions vs Variable

    sql task state

  6. How to Maintain State in a SQL Server Agent Job

    sql task state

VIDEO

  1. SQL task|Get bank mini statement task in SQL|PLSQL

  2. MSBI

  3. Sending an e-mail with SQL Query Results from a SmartConnect SQL Task

  4. SQL task on data fetching

  5. Evaluation of LLM based Text-to-SQL models

  6. SQL TASK'S PART 1

COMMENTS

  1. Suspended status in SQL Activity Monitor

    The other case it can happen is with linked servers when SQL Server is querying a remote table, in this case SQL Server is waiting for the remote server to respond. ... Queries going into suspended state immediately. 3. SQL Server 2005 Sleep_Task Wait Type. 0. sql server 2008 , suspend process. 1. Query in Sleep status. 1.

  2. sql server

    2. Run sp_who2 to find the suspended spid's. Then right click on the server name and open "Activity Monitor". In Activity Monitor in the Processes section, look for that spid in the "Blocked By" column. That will tell you which process is preventing your suspended process from running. answered Dec 2, 2021 at 21:56.

  3. sql server

    I was applying an index to a database with archived data. I knew this would take quite a while. It was at 14 hours running when I left it last night. I came back to it this morning and enterprise manager told me it had lost connection. On checking activity monitor on the server, I can see the task. Its state is SUSPENDED with a wait type of IO ...

  4. SQL SERVER

    Put simply, queries in SQL Server can exist in one of three states while executing inside the database engine. These states are defined as: RUNNING-meaning that the query is actively running on the CPU. RUNNABLE-meaning that the query is ready to run but CPU resources are not yet available. It is waiting in the Runnable Queue for a CPU to ...

  5. sys.dm_os_tasks (Transact-SQL)

    To call this from Azure Synapse Analytics or Analytics Platform System (PDW), use the name sys.dm_pdw_nodes_os_tasks. This syntax is not supported by serverless SQL pool in Azure Synapse Analytics. Memory address of the object. State of the task. This can be one of the following: PENDING: Waiting for a worker thread.

  6. SQL Server Activity Monitor

    Login - the SQL Server login that runs the session. Database - the database name on which the process is running. Task State - the task state, blank for tasks in the runnable and sleeping state. The value can also be obtained using the sys.dm_os_tasks view, as the task_state column. The states returned can be: "PENDING: Waiting for a ...

  7. Thread and task architecture guide

    A SQL Server worker thread, also known as worker or thread, is a logical representation of an operating system thread. When executing serial requests, the SQL Server Database Engine spawns a worker to execute the active task (1:1). When executing parallel requests in row mode, the SQL Server Database Engine assigns a worker to coordinate the ...

  8. How to use and interpret the SQL Server Activity monitor

    State - indicates the state of the process. If the process is in the runnable or sleep state, the state will be marked as N/A. In other cases, the state can have one of the following values: Running, Suspended, or Background. Command - indicates the SQL command used by the process at the moment of monitoring.

  9. Understanding different SQL Server database states

    There are seven main states in which a SQL Server database can exit. The below SELECT statement will query the sys.databases catalog view for the name and state for all databases hosted in the current SQL Server instance: 1. 2. 3. SELECT name, state_desc FROM sys.databases.

  10. Utilizing SQL Server, Part 1: Using Activity Monitor

    Login - The SQL Server login name under which the session is currently executing. Database - The name of the database that is included in the connection properties of processes that are currently running. Task State - The state of the task. For tasks in a runnable or sleeping state, the task state is blank.

  11. sql server

    2. I have a query that is run as part of a larger transaction. The query usually completes in under .5 seconds. It looks like it became stuck in a suspended state indefinitely until I killed the query. I have an extended event to monitor blocking. The query didn't have any updates to lastbatchcompleted during the time it was blocking.

  12. Runnable, Running and Suspended

    SQL Server is actually doing the work that the query has asked. There are 3 normal ways that a task can stop being running: It completes. It has to wait on another resource (like reading data from disk) It has been running for 4ms. Suspended: This is the state when your task has been removed from the running state, either because it's 4ms is ...

  13. why status suspend fo this query and how to solve it

    It is perfectly normal for tasks to be "suspended" for short periods of time. This is not a problem or an indication of a problem. Simply running the query to get suspended tasks, may cause other queries to be suspended while it runs the query. However, the wait state on this particular query is a log related wait state which generally ...

  14. sql server

    Stop using sysprocesses its old and deprecated. Use sys.dm_exec_requests instead. In some cases sleeping task is OK it means connection is still there and thread has done its task if you see lot of sleeping task you need to get in touch with application developer to see if sessions are closed after they have done the task -

  15. sys.dm_os_workers (Transact-SQL)

    Remarks. If the worker state is RUNNING and the worker is running nonpreemptively, the worker address matches the active_worker_address in sys.dm_os_schedulers. When a worker that is waiting on an event is signaled, the worker is placed at the head of the runnable queue. SQL Server allows for this to happen one thousand times in a row, after ...

  16. sql server

    7. In SQL Server 2012, an Index Rebuild job is taking a very long time (up to 8 hours). However, not even one Index rebuild completed, so I stopped the index job. In monitoring SQL task: Thanks in advance for any helpful info. LCK_M_SCH_M means something has a schema lock that is blocking your process. If you run sp_who2, you should see a ...

  17. How to Extract Values from a Nested JSON Field in SQL Server

    SQL Server provides robust support for JSON, making it easier to store, query, and manipulate JSON data within your database. One common task is extracting values from nested JSON fields. This article will guide you through the process of extracting values from a nested JSON field in SQL Server, complete with example queries and explanations.

  18. sql

    END; This is useful because I can call this function and check if the job I want to start is already running before I attempt to start it, without adding a lot of bloat to my code. for example: DECLARE @JobName varchar(140) = 'MyAgentJobName'. IF (SELECT dbo.IsJobAlreadyRunning(@JobName)) = 0.

  19. Execute SQL Task

    In SQL Server Data Tools (SSDT), open the Integration Services package you want to work with. In Solution Explorer, double-click the package to open it. Click the Control Flow tab. If the package does not already include an Execute SQL task, add one to the control flow of the package.

  20. Publish task lists to define and track work in your organization

    As a Teams user who is enabled for task publishing, you can centrally define tasks in the Planner app and distribute them to the teams in your organization who must perform the work. Workers see their assigned tasks in the Planner app, managers can track task progress for their locations, and org leaders have full visibility of progress across all locations.

  21. Task

    Enumerates the current state of TaskManagerState. ... This browser is no longer supported. Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

  22. SQL Server process Task state Suspended and Read Timeout

    I am running parallelly multiple queries in a SQL Server. All of them is simple select statement without any filter/group by condition. Queries are running through Talend ETL tool. When I check the Activity Monitor, lot of processes are in Suspended state.