How can I from SQL Queries when using Aggregate functions like count, min, max etc?

How can I from SQL Queries when using Aggregate functions like count, min, max etc?

The query should be in a single line and maximum of 2000 characters. Please note that the number of queries is limited to five queries in one monitor. Also, note that the delimiter for query is new line. Total number of rows shown in the output is limited to 50 rows.

If there are more than one columns in the results, we recommend to have set a column which has string values as primary key in the monitor.

For queries involving counts we recommend to have a dummy column and use that as primary key.

Lets take for example some pending tasks for your application is stored in app_pending_tasks table and  you want to monitor the number of pending tasks for the application.

Typically we will form the query as given below.

select count(*) from app_pending_tasks

The problem with the above query is it doesn't have an identifier. Instead you can form the query as given below.

For MySql, Oracle, Sybase:
---------------------------------
select  'Number of Pending Tasks', count(*) as totalcount from app_pending_tasks 

Make the 'Number of Pending Tasks' the primary column.

For MsSql, Postgres, Db2:
---------------------------------
select 'Number of Pending Tasks' as NumberOfPendingTasks, count(*) as totalcount from app_pending_tasks 

Make the 'Number of Pending Tasks' the primary column.

Now you can generate alarms by assigning thresholds and generate reports for 'totalcount'.

                  New to ADSelfService Plus?

                    • Related Articles

                    • Applications Manager Database Migration Using SQL Dump

                      Step 1: Rename Directories Skip this step if the directories are already renamed. Rename <AppManager_home>/working/pgsql to <AppManager_home>/working/pgsql_11. Rename <AppManager_home>/working/pgsql_15.5 to <AppManager_home>/working/pgsql. Step 1.1: ...
                    • APM Insight provides information on the parameters it sends to the SQL queries

                      The parameters in slow SQL queries can be tracked and displayed under the traces tab. We have the option to obfuscate the values of SQL query parameters using a configuration "Obfuscate SQL Parameters". It will be enabled by default. The screenshot ...
                    • Azure SQL Database - FAQ

                      1. Why have we removed the Diagnostic Settings dependency in Azure SQL Database monitor? Till APM v15240: Azure SQL Database was using Diagnostic Settings to perform data collection. Prerequisites had to be fulfilled to turn on Diagnostic Settings ...
                    • Troubleshooting MS SQL login failure

                      Login Failed. The login is from an untrusted domain and cannot be used with Windows authentication. Follow the steps given below the resolve this error. 1. Verify Credentials Ensure that the username and password of the SQL account (domain\username) ...
                    • Queries to collect data before Id migration/Migrating from Professional to Enterprise Edition

                      Collect query output from Managed server / Professional Edition: To check Id range : Select min(resourceid),max(resourceid) as AM_ManagedObject from AM_ManagedObject where resourceid > 10000000; Select count(*) as AM_ManagedObject_Count from ...