3. Tables
3.1 Capture
One row per sampled session per poll: the blocked requests (B), the heads of blocking chains (T) and the long running requests (L), each with its wait, the resource waited for, its statement and plan, and its work since the previous poll. request_state keeps each request's last counters for that calculation.
SqlBLT.session_base
The captured rows: at every poll, each blocked request (B), each head of a blocking chain (T) and each long running request (L), with its session and connection, its wait and the resource waited for, its transaction, its statement and plan, and its work in the poll's window (the columns ending in _inc). A name or value is held as the id of its SqlBLT.ref_value row; the statement text and the plan as the ids of their templates.
- Rows
- One row per sampled session per poll.
- Written by
SqlBLT.Collect, through the view SqlBLT.sessions and its trigger
- Primary key
now, row_id, clustered
- Storage
- Partitioned by
now on scheme psSqlBLT (function pfSqlBLT): a boundary per day, 14 partitions retained as installed. Page compression.
| Column | Type | Nullable | Key | Source | Aggregated as |
| now | datetime | not null | PK | getdate() at the start of the poll | agg_time (the poll time cut to the second, minute, hour and day) |
| row_id | int | not null | PK | The number of the row within the poll | samples (the rows counted) |
| BLT | char(1) | null | | B a blocked request, T the head of a blocking chain, L a long running request; decided from sys.dm_exec_requests.blocking_session_id and start_time | blt |
| session_id | smallint | null | | sys.dm_exec_requests.session_id; for a blocker without a request, blocking_session_id of the request it blocks | request_id (with last_req_start_time: SqlBLT.ref_request) |
| blocked | smallint | null | | sys.dm_exec_requests.blocking_session_id | |
| topblock | int | null | | The session at the head of the blocking chain, followed through blocking_session_id | |
| req_status_id | int | null | → ref_value | sys.dm_exec_requests.status; dictionary attribute 1 (req_status) | |
| session_status_id | int | null | → ref_value | sys.dm_exec_sessions.status; dictionary attribute 2 (session_status) | |
| open_trans | int | null | | sys.dm_exec_sessions.open_transaction_count (sys.sysprocesses.open_tran before SQL Server 2012) | |
| elapsed_ms | bigint | null | | The poll time minus sys.dm_exec_requests.start_time | elapsed_ms_max |
| wait_time_ms | bigint | null | | sys.dm_exec_requests.wait_time | wait_ms_max |
| req_cpu_ms | bigint | null | | sys.dm_exec_requests.cpu_time | read to tell whether the counters of the row are known |
| req_logical_reads | bigint | null | | sys.dm_exec_requests.logical_reads | read to tell whether the counters of the row are known |
| req_phys_reads | bigint | null | | sys.dm_exec_requests.reads | read to tell whether the counters of the row are known |
| req_writes | bigint | null | | sys.dm_exec_requests.writes | read to tell whether the counters of the row are known |
| mem_used | bigint | null | | sys.dm_exec_sessions.memory_usage | |
| command_id | int | null | → ref_value | sys.dm_exec_requests.command (sys.sysprocesses.cmd when the session has no request); dictionary attribute 3 (command) | |
| conn_dbid | int | null | | sys.dm_exec_sessions.database_id (sys.sysprocesses.dbid before SQL Server 2012) | |
| conn_db_id | int | null | → ref_value | db_name() of sys.dm_exec_sessions.database_id; dictionary attribute 4 (conn_db) | database_id |
| auth_dbid | int | null | | sys.dm_exec_sessions.authenticating_database_id | |
| auth_db_id | int | null | → ref_value | db_name() of sys.dm_exec_sessions.authenticating_database_id; dictionary attribute 5 (auth_db) | |
| sqltext_source | char(1) | null | | Where the text came from: S the statement by its offsets, B the batch or module (sys.dm_exec_sql_text), I the input buffer (sys.dm_exec_input_buffer), N none | |
| sqltext_objname_id | int | null | → ref_value | Schema and name of the module, from objectid and dbid of sys.dm_exec_sql_text; dictionary attribute 6 (sqltext_objname) | |
| wait_dbid | bigint | null | | The database id parsed from sys.dm_os_waiting_tasks.resource_description, else from sys.dm_exec_requests.wait_resource | |
| wait_dbname_id | int | null | → ref_value | db_name() of the database id parsed from the wait resource; dictionary attribute 7 (wait_dbname) | wait_dbname_id |
| wait_schname_id | int | null | → ref_value | sys.schemas.name of the waited object; dictionary attribute 8 (wait_schname) | wait_schname_id |
| wait_objname_id | int | null | → ref_value | sys.objects.name of the waited object; dictionary attribute 9 (wait_objname) | wait_objname_id |
| wait_object_type_id | int | null | → ref_value | sys.objects.type of the waited object; dictionary attribute 10 (wait_object_type) | |
| wait_index_id | int | null | | sys.partitions.index_id of the waited partition | |
| wait_indexname_id | int | null | → ref_value | sys.indexes.name of that index; dictionary attribute 11 (wait_indexname) | |
| wait_partition_number | int | null | | sys.partitions.partition_number | |
| wait_filename_id | int | null | → ref_value | sys.database_files.name of the waited file; dictionary attribute 12 (wait_filename) | |
| wait_filepath_id | int | null | → ref_value | sys.database_files.physical_name of the waited file; dictionary attribute 13 (wait_filepath) | |
| wait_object_id | bigint | null | | sys.objects.object_id, found through sys.partitions or sys.allocation_units; for a page through sys.dm_db_page_info or DBCC PAGE | |
| wait_file_id | bigint | null | | The file id parsed from the wait resource | |
| wait_resource_id | int | null | → ref_value | sys.dm_exec_requests.wait_resource; dictionary attribute 14 (wait_resource) | |
| last_wait_type_id | int | null | → ref_value | sys.dm_exec_requests.last_wait_type; dictionary attribute 15 (last_wait_type) | |
| connect_time | datetime | null | | sys.dm_exec_connections.connect_time | |
| last_req_end_time | datetime | null | | sys.dm_exec_sessions.last_request_end_time | |
| last_req_start_time | datetime | null | | sys.dm_exec_sessions.last_request_start_time | request_id (with session_id: SqlBLT.ref_request) |
| wait_type_id | int | null | → ref_value | sys.dm_exec_requests.wait_type; dictionary attribute 16 (wait_type) | wait_type_id |
| task_wait_type_id | int | null | → ref_value | sys.dm_os_waiting_tasks.wait_type; dictionary attribute 17 (task_wait_type) | |
| task_wait_ms | bigint | null | | sys.dm_os_waiting_tasks.wait_duration_ms | |
| is_user | bit | not null default 0 | | sys.dm_exec_sessions.is_user_process | |
| req_mode_id | int | null | → ref_value | The lock mode parsed from sys.dm_os_waiting_tasks.resource_description; dictionary attribute 18 (req_mode) | |
| tran_begin_time | datetime | null | | The earliest sys.dm_tran_database_transactions.database_transaction_begin_time of the session's transactions (sys.dm_tran_session_transactions) | |
| ms_since_tran_begin_time | bigint | null | | The poll time minus tran_begin_time | |
| tran_name_id | int | null | → ref_value | sys.dm_tran_active_transactions.name of the session's earliest user transaction; dictionary attribute 19 (tran_name) | |
| is_implicit_tran | smallint | null | | 1 when that transaction is named implicit_transaction | |
| resource_type_id | int | null | → ref_value | Parsed from sys.dm_os_waiting_tasks.resource_description, else from sys.dm_exec_requests.wait_resource; dictionary attribute 20 (resource_type) | resource_type_id |
| resource_subtype_id | int | null | → ref_value | Parsed from sys.dm_os_waiting_tasks.resource_description, else from sys.dm_exec_requests.wait_resource; dictionary attribute 21 (resource_subtype) | |
| resource_descr_id | int | null | → ref_value | sys.dm_os_waiting_tasks.resource_description; dictionary attribute 22 (resource_description) | |
| resource_associated_entity_id | bigint | null | | The object, HoBT or allocation unit id parsed from the wait resource | |
| resource_lock_partition | int | null | | The lock partition parsed from the wait resource | |
| statement_start_offset | int | null | | sys.dm_exec_requests.statement_start_offset | |
| statement_end_offset | int | null | | sys.dm_exec_requests.statement_end_offset | |
| query_hash | binary(8) | null | | sys.dm_exec_requests.query_hash | |
| query_plan_hash | binary(8) | null | | sys.dm_exec_requests.query_plan_hash | |
| host_name_id | int | null | → ref_value | sys.dm_exec_sessions.host_name; dictionary attribute 23 (host_name) | host_name_id |
| program_name_id | int | null | → ref_value | sys.dm_exec_sessions.program_name, with the name of a SQL Agent job in place of its id (SQLAgent - TSQL JobStep (Job name : Step n)) where msdb can be read; dictionary attribute 24 (program_name) | program_name_id |
| host_process_id | int | null | | sys.dm_exec_sessions.host_process_id | |
| client_version | bigint | null | | sys.dm_exec_sessions.client_version | |
| client_interface_id | int | null | → ref_value | sys.dm_exec_sessions.client_interface_name; dictionary attribute 25 (client_interface_name) | |
| login_name_id | int | null | → ref_value | sys.dm_exec_sessions.login_name; dictionary attribute 26 (login_name) | login_name_id |
| tran_isolation_level | smallint | null | | sys.dm_exec_sessions.transaction_isolation_level | |
| lock_timeout | int | null | | sys.dm_exec_sessions.lock_timeout | |
| deadlock_priority | int | null | | sys.dm_exec_sessions.deadlock_priority | |
| net_transport_id | int | null | → ref_value | sys.dm_exec_connections.net_transport; dictionary attribute 27 (net_transport) | |
| protocol_type_id | int | null | → ref_value | sys.dm_exec_connections.protocol_type; dictionary attribute 28 (protocol_type) | |
| protocol_version | int | null | | sys.dm_exec_connections.protocol_version | |
| encrypt_option_id | int | null | → ref_value | sys.dm_exec_connections.encrypt_option; dictionary attribute 29 (encrypt_option) | |
| auth_scheme_id | int | null | → ref_value | sys.dm_exec_connections.auth_scheme; dictionary attribute 30 (auth_scheme) | |
| node_affinity | smallint | null | | sys.dm_exec_connections.node_affinity | |
| conn_packet_reads | bigint | null | | sys.dm_exec_connections.num_reads | |
| conn_packet_writes | bigint | null | | sys.dm_exec_connections.num_writes | |
| conn_last_read | datetime | null | | sys.dm_exec_connections.last_read | |
| conn_last_write | datetime | null | | sys.dm_exec_connections.last_write | |
| net_packet_size | int | null | | sys.dm_exec_connections.net_packet_size | |
| client_net_addr_id | int | null | → ref_value | sys.dm_exec_connections.client_net_address; dictionary attribute 31 (client_net_address) | |
| client_tcp_port | int | null | | sys.dm_exec_connections.client_tcp_port | |
| local_net_addr_id | int | null | → ref_value | sys.dm_exec_connections.local_net_address; dictionary attribute 32 (local_net_address) | |
| local_tcp_port | int | null | | sys.dm_exec_connections.local_tcp_port | |
| sql_handle | varbinary(64) | null | | sys.dm_exec_requests.sql_handle (sys.dm_exec_connections.most_recent_sql_handle when the session has no request) | |
| secs_since_last_req_end | bigint | null | | The poll time minus last_req_end_time | |
| isdbccpage | smallint | null | | How a page resource was resolved: 1 DBCC PAGE, 2 sys.dm_db_page_info | |
| waittype | binary(2) | null | | sys.sysprocesses.waittype | |
| qplan_key | char(18) | null | | 0x and the hexadecimal form of sys.dm_exec_requests.query_plan_hash | |
| plan_handle | varbinary(64) | null | | sys.dm_exec_requests.plan_handle | |
| percent_complete | decimal(5,2) | null | | sys.dm_exec_requests.percent_complete | |
| est_completion_time | bigint | null | | sys.dm_exec_requests.estimated_completion_time | |
| pass | char(2) | null | | The pass of the poll in which a lookup for the row failed | |
| error_number | int | null | | error_number() of that failure | |
| error_message_id | int | null | → ref_value | error_message() of that failure; dictionary attribute 33 (error_message) | |
| sqltextid | int | null | → ref_sqltext | The template (SqlBLT.ref_sqltext) of the text from sys.dm_exec_sql_text or sys.dm_exec_input_buffer, parsed by SqlBLT.fnParseSQL | sqltextid |
| qplanid | int | null | → ref_qplan | The template (SqlBLT.ref_qplan) of the plan from sys.dm_exec_text_query_plan, parsed by SqlBLT.fnParseQPlan; or the template already known for the query_plan_hash | qplanid |
| req_wait_ms_inc | bigint | null | | The growth of wait_time_ms since the request's previous sample (SqlBLT.request_state), within the poll's window | wait_ms |
| req_cpu_ms_inc | bigint | null | | The growth of req_cpu_ms since the request's previous sample (SqlBLT.request_state), within the poll's window | cpu_ms |
| req_logical_reads_inc | bigint | null | | The growth of req_logical_reads since the request's previous sample (SqlBLT.request_state), within the poll's window | logical_reads |
| req_phys_reads_inc | bigint | null | | The growth of req_phys_reads since the request's previous sample (SqlBLT.request_state), within the poll's window | physical_reads |
| req_writes_inc | bigint | null | | The growth of req_writes since the request's previous sample (SqlBLT.request_state), within the poll's window | writes |
| stmt_wait_ms_inc | bigint | null | | The growth of the wait within the statement, in the poll's window; null on the statement's first sample | stmt_wait_ms |
| stmt_cpu_ms_inc | bigint | null | | The growth of the CPU time within the statement, in the poll's window; null on the statement's first sample | stmt_cpu_ms |
| stmt_logical_reads_inc | bigint | null | | The growth of the logical reads within the statement, in the poll's window; null on the statement's first sample | stmt_logical_reads |
| stmt_phys_reads_inc | bigint | null | | The growth of the physical reads within the statement, in the poll's window; null on the statement's first sample | stmt_physical_reads |
| stmt_writes_inc | bigint | null | | The growth of the writes within the statement, in the poll's window; null on the statement's first sample | stmt_writes |
| child_wait_ms | bigint | null | | The sum of wait_time_ms of the requests the session blocks, directly or through other blocked requests | child_wait_ms_max |
| child_wait_ms_inc | bigint | null | | The same sum over req_wait_ms_inc | child_wait_ms |
| qplan_att_id | int | null | → ref_qplan_attribute | The attributes (SqlBLT.ref_qplan_attribute) of the plan from sys.dm_exec_text_query_plan: its warnings, plan guide and reasons; null with QPlanLogAttributes = 0 | |
| qplan_time_id | int | null | → ref_qplan_time | The compile values (SqlBLT.ref_qplan_time) of that plan; null with QPlanLogAttributes = 0 | |
SqlBLT.request_state
The last sample of each request that SqlBLT.Collect has stored: its cumulative CPU time, reads and writes, its wait and its statement. At the next poll SqlBLT.Collect subtracts them from the request's new values, which gives the increments stored in SqlBLT.session_base. Rows not sampled for a day are deleted at the first poll of each hour.
- Rows
- One row per request (session_id, last_req_start).
- Written by
SqlBLT.Collect
- Primary key
session_id, last_req_start, clustered
- Storage
- Not partitioned.
| Column | Type | Nullable | Key | Definition |
| session_id | smallint | not null | PK | With last_req_start: the request key |
| last_req_start | datetime | not null | PK | The start time of the request (sys.dm_exec_sessions.last_request_start_time) |
| req_cpu_ms | bigint | not null | | The request's last known sample (SqlBLT.Collect), for the next poll's increments |
| req_logical_reads | bigint | not null | | Its logical reads at that sample |
| req_phys_reads | bigint | not null | | Its physical reads at that sample |
| req_writes | bigint | not null | | Its writes at that sample |
| wait_time_ms | bigint | not null | | Its wait time at that sample |
| wait_type | nvarchar(256) | null | | Its wait type at that sample |
| sql_handle | varbinary(64) | null | | With the offsets: the statement of the sample |
| stmt_start_offset | int | null | | The start of the statement in its batch |
| stmt_end_offset | int | null | | The end of the statement in its batch |
| last_now | datetime | not null | | The poll of the sample; rows a day older than a poll go, at the first poll of each hour |
3.2 Dictionaries and templates
Each name or value once (database, host, login, program, wait type, resource and others), referred to by id; each statement text and each query plan once, as a de-parameterised template; each request once; the number of references that the rows hold to each text, plan and value; the missing index recommendations of SQL Server for the queries of the requests captured.
SqlBLT.ref_type
The attributes whose values SqlBLT.ref_value holds.
- Rows
- One row per dictionary attribute: 33 rows.
- Written by
- The install script
- Primary key
bpat_id, clustered
- Storage
- Not partitioned.
| Column | Type | Nullable | Key | Definition |
| bpat_id | smallint | not null | PK | The attribute: 1 to 33 |
| bpat_attribute | nvarchar(128) | not null | | Its name: the column of the view SqlBLT.sessions that shows the value |
SqlBLT.ref_value
The dictionary. A name or value that recurs in the captured rows (a database, host, login or program name, a wait type, a resource description and others) is stored once; SqlBLT.session_base and the aggregate tables hold its bpat_value_id.
- Rows
- One row per distinct value of an attribute.
- Written by
SqlBLT.Collect, through the trigger of SqlBLT.sessions
- Primary key
bpat_value_id, clustered
- Storage
- Not partitioned.
- Indexes
ux_ref_value: unique, on bpat_id, bpat_value_hash
- Checks
ck_ref_value_none: bpat_value_id = -1 or (bpat_id is not null and bpat_value_hash is not null and bpat_value is not null)
| Column | Type | Nullable | Key | Definition |
| bpat_value_id | int | not null identity | PK | The id of the value |
| bpat_id | smallint | null | → ref_type | The attribute the value belongs to |
| bpat_value_hash | binary(16) | null | | hashbytes('MD5', bpat_value) |
| bpat_value | nvarchar(3072) | null | | The value |
SqlBLT.ref_sqltext
The statement texts. With the setting ParseSqlText = 1, as installed, a captured text is de-parameterised by the SQL parser, which replaces its literals by ?, so texts that differ only in their literals share one row, their template; with 0 the parser is not run and every distinct text is a row of its own. The template is stored compressed (COMPRESS). With the setting StoreSqlTextSample = 1 the text as captured is stored too: for a template, the first original text that produced it.
- Rows
- One row per distinct text template; with the setting
ParseSqlText = 0, one row per distinct text as captured.
- Written by
SqlBLT.Collect
- Primary key
sqltextid, clustered
- Storage
- Not partitioned.
- Indexes
ux_ref_sqltext: unique, on sqltext_chash
- Checks
ck_ref_sqltext_none: sqltextid = -1 or sqltext_chash is not null
| Column | Type | Nullable | Key | Definition |
| sqltextid | int | not null identity | PK | The id of the statement |
| sqltext_chash | varchar(88) | null | | Hash of the template, or of the text as captured when @ParseSqlText = 0; null in the row of the key -1 alone |
| sqltext_parsed | varbinary(max) | null | | COMPRESS of the template (the text the SQL parser returns); null when @ParseSqlText = 0 |
| sqltext_unparsed | varbinary(max) | null | | COMPRESS of the text as captured: with @ParseSqlText = 1 the first original text that produced the template row; null when @StoreSqlTextSample = 0 |
| sqltextleading | nvarchar(2048) | null | | First 2,048 characters of the template, or of the text as captured when @ParseSqlText = 0; null when neither is stored |
SqlBLT.ref_sqltext_key
Maps the hash of a text as fetched to its template, so that a text seen before is not parsed again.
- Rows
- One row per distinct text as fetched.
- Written by
SqlBLT.Collect
- Primary key
sqltext_chash, clustered
- Storage
- Not partitioned.
| Column | Type | Nullable | Key | Definition |
| sqltext_chash | varchar(88) | not null | PK | Hash of the raw text as fetched |
| sqltextid | int | not null | → ref_sqltext | ref_sqltext.sqltextid of its template |
SqlBLT.ref_qplan
The query plans. With the setting ParseQPlans = 1, as installed, a captured plan (showplan XML) is parsed into its template: its literals and generated names are masked, the compile, statistics, memory and hardware detail removed and the estimates set to 0, while the shape and the operators are kept; with 0 the parser is not run and every distinct plan fetched is a row of its own. With the setting QPlanSkipStorageOfKnownHashes = 1 a plan is not parsed or stored again when its query_plan_hash already has one (SqlBLT.ref_qplan_hash). The template is stored compressed (COMPRESS). With the setting StoreQPlanSample = 1 the plan as captured is stored too: for a template, the first raw plan that produced it.
- Rows
- One row per distinct plan template; with the setting
ParseQPlans = 0, one row per distinct plan fetched.
- Written by
SqlBLT.Collect
- Primary key
qplanid, clustered
- Storage
- Not partitioned.
- Indexes
ux_ref_qplan: unique, on qplan_chash
- Checks
ck_ref_qplan_none: qplanid = -1 or qplan_chash is not null
| Column | Type | Nullable | Key | Definition |
| qplanid | int | not null identity | PK | The id of the plan |
| qplan_chash | varchar(88) | null | | Hash of the plan template, or of the plan as captured when @ParseQPlans = 0; null in the row of the key -1 alone |
| qplan_parsed | varbinary(max) | null | | COMPRESS of the template (the text the plan parser returns); null when @ParseQPlans = 0 |
| qplan_unparsed | varbinary(max) | null | | COMPRESS of the plan as captured: with @ParseQPlans = 1 the first raw plan that produced the template row; null when @StoreQPlanSample = 0 |
SqlBLT.ref_qplan_key
Maps the hash of a plan as fetched to its template, so that a plan seen before is not parsed again.
- Rows
- One row per distinct plan as fetched.
- Written by
SqlBLT.Collect
- Primary key
qplan_chash, clustered
- Storage
- Not partitioned.
| Column | Type | Nullable | Key | Definition |
| qplan_chash | varchar(88) | not null | PK | Hash of the raw plan as fetched |
| qplanid | int | not null | → ref_qplan | ref_qplan.qplanid of its template |
SqlBLT.ref_qplan_hash
Maps the engine's query_plan_hash of a statement to the first template stored for it. With the setting QPlanSkipStorageOfKnownHashes = 1 the plan of a statement whose query_plan_hash is here is not parsed or stored again.
- Rows
- One row per query_plan_hash.
- Written by
SqlBLT.Collect
- Primary key
query_plan_hash, clustered
- Storage
- Not partitioned.
| Column | Type | Nullable | Key | Definition |
| query_plan_hash | binary(8) | not null | PK | The engine's query_plan_hash of a statement whose plan has been templated |
| qplanid | int | not null | → ref_qplan | ref_qplan.qplanid of the first template seen for it |
SqlBLT.ref_request
The requests that SqlBLT.Aggregate has read, each with its first and last poll and its statement at those polls. request_id is the key of the request dimension of the aggregate tables.
- Rows
- One row per request (session_id, last_req_start).
- Written by
SqlBLT.Aggregate
- Primary key
request_id, clustered
- Storage
- Not partitioned.
- Indexes
ux_ref_request: unique, on session_id, last_req_start
- Checks
ck_ref_request_none: request_id = -1 or (session_id is not null and first_now is not null and last_now is not null)
| Column | Type | Nullable | Key | Definition |
| request_id | int | not null identity | PK | The request dimension's key (bit 1024) |
| session_id | smallint | null | | With last_req_start: the request as SQL Server reports it; null in the row of the key -1 alone |
| last_req_start | datetime | null | | The start time of the request (SqlBLT.session_base.last_req_start_time) |
| first_now | datetime | null | | The first poll that captured it |
| last_now | datetime | null | | The last poll that captured it |
| sqltextid_first | int | null | → ref_sqltext | Its statement at the first poll |
| sqltextid_last | int | null | → ref_sqltext | Its statement at the last poll |
| qplanid_last | int | null | → ref_qplan | Its plan at the last poll |
SqlBLT.ref_counts
The reference counts of the statement texts, the query plans and the dictionary values: how many references the rows of SqlBLT.session_base, agg_second, agg_minute, agg_hour and agg_day hold to one row of SqlBLT.ref_sqltext, SqlBLT.ref_qplan or SqlBLT.ref_value. objid and ref_objid are SqlBLT.size_object.objid. A count is added in the transaction that inserts the rows and taken off by SqlBLT.MaintainPartitions when it truncates a partition; a count that reaches 0 loses its row. A text or plan without a row here is referenced by no row, and SqlBLT.MaintainPartitions deletes it. The counts are rebuilt from the rows on the days that the settings RebuildRefCountsDayOfMonth and RebuildRefCountsDayOfWeek name.
- Rows
- One row per referencing table (objid), referenced table (ref_objid) and referenced row (ref_id).
- Written by
SqlBLT.Collect (through the trigger of SqlBLT.sessions), SqlBLT.Aggregate and SqlBLT.MaintainPartitions
- Primary key
objid, ref_objid, ref_id, clustered
- Storage
- Not partitioned.
| Column | Type | Nullable | Key | Definition |
| objid | smallint | not null | PK → size_object | size_object.objid: the table that holds the references |
| ref_objid | smallint | not null | PK → size_object | size_object.objid: the table referenced: ref_sqltext, ref_qplan or ref_value |
| ref_id | int | not null | PK | The row referenced: its sqltextid, qplanid or bpat_value_id |
| ref_count | bigint | not null | | The number of references |
SqlBLT.ref_missing_index
The missing index recommendations of SQL Server for the queries of the requests captured (setting CaptureMissingIndexes = 1): the table of the index and its equality, inequality and included columns, as SQL Server names them. missing_index_hash, over the table and the three column lists, keeps each index once. SqlBLT.MaintainPartitions deletes an index that no row of SqlBLT.ref_query_missing_index names any more.
- Rows
- One row per index that SQL Server recommends.
- Written by
SqlBLT.Collect
- Primary key
missing_index_id, clustered
- Storage
- Not partitioned.
- Indexes
ux_ref_missing_index: unique, on missing_index_hash
| Column | Type | Nullable | Key | Definition |
| missing_index_id | int | not null identity | PK | The id of the index recommended |
| missing_index_hash | binary(16) | not null | | hashbytes('MD5') of the table's three-part name and the three column lists: the row's natural key |
| dbname | nvarchar(128) | null | | The table's database |
| schname | nvarchar(128) | null | | Its schema |
| objname | nvarchar(128) | null | | The table |
| equality_columns | nvarchar(4000) | null | | The columns compared for equality, as sys.dm_db_missing_index_details lists them: [a], [b] |
| inequality_columns | nvarchar(4000) | null | | The columns of the other comparisons, listed likewise |
| included_columns | nvarchar(4000) | null | | The columns to include, listed likewise |
SqlBLT.ref_query_missing_index
Which index SQL Server recommends for which query of the requests captured, with the first and the last poll at which the recommendation was found; a row is written at most once a minute. On SQL Server 2019 and later the recommendations are read from sys.dm_db_missing_index_group_stats_query at every poll, with avg_user_impact, user_seeks, user_scans and avg_total_user_cost as last read, and group_handle finds the row of a recommendation again while the instance runs, so that its index is read from sys.dm_db_missing_index_details once; before it they are read from the MissingIndexes element of each plan a poll fetches, with the Impact of the plan as avg_user_impact, and last_seen follows the polls at which a request has the query. The rows of a statement text are deleted with the text by SqlBLT.MaintainPartitions.
- Rows
- One row per statement text, query (query_hash, query_plan_hash) and index recommended for it.
- Written by
SqlBLT.Collect
- Primary key
sqltextid, query_hash, query_plan_hash, missing_index_id, clustered
- Storage
- Not partitioned.
- Indexes
ix_ref_query_missing_index: on missing_index_id
| Column | Type | Nullable | Key | Definition |
| sqltextid | int | not null | PK → ref_sqltext | ref_sqltext.sqltextid: the statement text of the requests |
| query_hash | binary(8) | not null | PK | The engine's query_hash of the requests |
| query_plan_hash | binary(8) | not null | PK | The engine's query_plan_hash of the requests |
| missing_index_id | int | not null | PK → ref_missing_index | ref_missing_index.missing_index_id: the index recommended |
| first_seen | datetime | not null | | The first poll at which the recommendation was found for a request captured |
| last_seen | datetime | not null | | The last poll at which it was found; written at most once a minute |
| avg_user_impact | float | null | | percent: the view's avg_user_impact as last read; without the view the Impact of the plan's MissingIndexGroup |
| user_seeks | bigint | null | | The view's user_seeks as last read; null without the view |
| user_scans | bigint | null | | The view's user_scans as last read; null without the view |
| avg_total_user_cost | float | null | | The view's avg_total_user_cost as last read; null without the view |
| group_handle | int | null | | The view's group_handle of the recommendation: it identifies the recommendation while the instance runs, so a row seen since the instance started is found again by it; null without the view |
3.3 Query plan attributes
What the plan of a request carries besides its shape: the warnings of the query optimizer with the columns, conversions and indexes they name, the plan guide, the reasons and the compile values; each text value once.
SqlBLT.ref_qplan_value
A text value of the plan attributes that repeats, stored once: the name of a database, a schema, a table or a plan guide, a reason, a conversion issue, a data type. The other tables hold its qplan_value_id. SqlBLT.MaintainPartitions deletes a value that no row names any more.
- Rows
- One row per text value.
- Written by
SqlBLT.Collect
- Primary key
qplan_value_id, clustered
- Storage
- Not partitioned.
- Indexes
ux_ref_qplan_value: unique, on qplan_value
| Column | Type | Nullable | Key | Definition |
| qplan_value_id | int | not null identity | PK | The id of the text value |
| qplan_value | nvarchar(128) | not null | | The text, as SQL Server gives it |
SqlBLT.ref_qplan_attribute
The attributes of a query plan other than its shape (setting QPlanLogAttributes = 1): UsePlan, the plan guide, NonParallelPlanReason, CardinalityEstimationModelVersion, StatementOptmEarlyAbortReason, the number of joins without a join predicate, and three lists. att_hash finds a combination again. A row of SqlBLT.session_base names its combination (qplan_att_id).
- Rows
- One row per plan and combination of attributes.
- Written by
SqlBLT.Collect
- Primary key
qplan_att_id, clustered
- Storage
- Not partitioned.
- Indexes
ux_ref_qplan_attribute: unique, on qplanid, att_hash
| Column | Type | Nullable | Key | Definition |
| qplan_att_id | int | not null identity | PK | The id of the combination |
| qplanid | int | not null | → ref_qplan | ref_qplan.qplanid: the plan |
| att_hash | binary(16) | not null | | hashbytes('MD5') of the columns below and of the ids of the three lists: finds a combination again; it holds no data of its own |
| use_plan | bit | null | | UsePlan: 1 = the plan is forced (a USE PLAN hint, a plan guide or Query Store) |
| ce_model_version | smallint | null | | CardinalityEstimationModelVersion: 70 = the legacy cardinality estimator |
| no_join_predicates | smallint | not null | | The joins of the plan without a join predicate (the warning NoJoinPredicate) |
| plan_guide_db_id | int | null | → ref_qplan_value | ref_qplan_value.qplan_value_id: PlanGuideDB, the database of the plan guide applied |
| plan_guide_name_id | int | null | → ref_qplan_value | ref_qplan_value.qplan_value_id: PlanGuideName, the plan guide applied |
| non_parallel_plan_reason_id | int | null | → ref_qplan_value | ref_qplan_value.qplan_value_id: NonParallelPlanReason, why the plan is serial, as SQL Server states it |
| optm_early_abort_reason_id | int | null | → ref_qplan_value | ref_qplan_value.qplan_value_id: StatementOptmEarlyAbortReason: TimeOut, MemoryLimitExceeded or GoodEnoughPlanFound |
SqlBLT.ref_qplan_time
The values of a plan that differ from one compilation to the next: CompileTime, CompileCPU, CompileMemory and the SerialDesiredMemory of the memory grant. A row of SqlBLT.session_base names its set (qplan_time_id).
- Rows
- One row per plan and set of compile values.
- Written by
SqlBLT.Collect
- Primary key
qplan_time_id, clustered
- Storage
- Not partitioned.
- Indexes
ux_ref_qplan_time: unique, on qplanid, compile_ms, compile_cpu_ms, compile_memory_kb, serial_desired_memory_kb
| Column | Type | Nullable | Key | Definition |
| qplan_time_id | int | not null identity | PK | The id of the set of compile values |
| qplanid | int | not null | → ref_qplan | ref_qplan.qplanid: the plan |
| compile_ms | int | null | | CompileTime: milliseconds |
| compile_cpu_ms | int | null | | CompileCPU: milliseconds |
| compile_memory_kb | int | null | | CompileMemory: KB |
| serial_desired_memory_kb | bigint | null | | SerialDesiredMemory of the memory grant: KB |
| last_seen | datetime | not null | | The last poll at which a request captured had these values; written at most once a minute |
SqlBLT.ref_qplan_column
A column named by ColumnsWithNoStatistics or converted by a PlanAffectingConvert, stored once whichever warning names it.
- Rows
- One row per column that a warning names.
- Written by
SqlBLT.Collect
- Primary key
qplan_column_id, clustered
- Storage
- Not partitioned.
- Indexes
ux_ref_qplan_column: unique, on dbname_id, schname_id, objname_id, colname
| Column | Type | Nullable | Key | Definition |
| qplan_column_id | int | not null identity | PK | The id of the column |
| colname | nvarchar(128) | not null | | The column |
| dbname_id | int | null | → ref_qplan_value | ref_qplan_value.qplan_value_id: the column's database; null where the plan names none |
| schname_id | int | null | → ref_qplan_value | ref_qplan_value.qplan_value_id: its schema |
| objname_id | int | null | → ref_qplan_value | ref_qplan_value.qplan_value_id: its table or view |
SqlBLT.ref_qplan_index
A filtered index that a parameterised statement cannot use (UnmatchedIndexes).
- Rows
- One row per index that a warning names.
- Written by
SqlBLT.Collect
- Primary key
qplan_index_id, clustered
- Storage
- Not partitioned.
- Indexes
ux_ref_qplan_index: unique, on dbname_id, schname_id, objname_id, indexname
| Column | Type | Nullable | Key | Definition |
| qplan_index_id | int | not null identity | PK | The id of the index |
| indexname | nvarchar(128) | not null | | The index |
| dbname_id | int | null | → ref_qplan_value | ref_qplan_value.qplan_value_id: the index's database |
| schname_id | int | null | → ref_qplan_value | ref_qplan_value.qplan_value_id: its schema |
| objname_id | int | null | → ref_qplan_value | ref_qplan_value.qplan_value_id: its table or view |
SqlBLT.ref_qplan_convert
A PlanAffectingConvert warning: its issue (Seek Plan or Cardinality Estimate), the data type converted to, the column converted and the expression, its literals masked.
- Rows
- One row per conversion that affects a plan.
- Written by
SqlBLT.Collect
- Primary key
qplan_convert_id, clustered
- Storage
- Not partitioned.
- Indexes
ux_ref_qplan_convert: unique, on convert_issue_id, qplan_column_id, to_type_id, expression
| Column | Type | Nullable | Key | Definition |
| qplan_convert_id | int | not null identity | PK | The id of the conversion |
| qplan_column_id | int | null | → ref_qplan_column | ref_qplan_column.qplan_column_id: the column converted; null where the expression converts no column |
| expression | nvarchar(400) | not null | | Expression: the conversion as SQL Server states it, its literals masked by the SQL parser; the first 400 characters |
| convert_issue_id | int | not null | → ref_qplan_value | ref_qplan_value.qplan_value_id: ConvertIssue: Seek Plan (the conversion prevented an index seek) or Cardinality Estimate |
| to_type_id | int | null | → ref_qplan_value | ref_qplan_value.qplan_value_id: the data type converted to |
SqlBLT.ref_qplan_att_no_statistics
The list ColumnsWithNoStatistics of a combination of attributes.
- Rows
- One row per combination and column without statistics.
- Written by
SqlBLT.Collect
- Primary key
qplan_att_id, qplan_column_id, clustered
- Storage
- Not partitioned.
- Indexes
ix_ref_qplan_att_no_statistics: on qplan_column_id
| Column | Type | Nullable | Key | Definition |
| qplan_att_id | int | not null | PK → ref_qplan_attribute | ref_qplan_attribute.qplan_att_id |
| qplan_column_id | int | not null | PK → ref_qplan_column | ref_qplan_column.qplan_column_id: a column without statistics |
SqlBLT.ref_qplan_att_convert
The list PlanAffectingConvert of a combination of attributes.
- Rows
- One row per combination and conversion.
- Written by
SqlBLT.Collect
- Primary key
qplan_att_id, qplan_convert_id, clustered
- Storage
- Not partitioned.
- Indexes
ix_ref_qplan_att_convert: on qplan_convert_id
| Column | Type | Nullable | Key | Definition |
| qplan_att_id | int | not null | PK → ref_qplan_attribute | ref_qplan_attribute.qplan_att_id |
| qplan_convert_id | int | not null | PK → ref_qplan_convert | ref_qplan_convert.qplan_convert_id: a conversion that affects the plan |
SqlBLT.ref_qplan_att_unmatched_index
The list UnmatchedIndexes of a combination of attributes.
- Rows
- One row per combination and unmatched index.
- Written by
SqlBLT.Collect
- Primary key
qplan_att_id, qplan_index_id, clustered
- Storage
- Not partitioned.
- Indexes
ix_ref_qplan_att_unmatched_index: on qplan_index_id
| Column | Type | Nullable | Key | Definition |
| qplan_att_id | int | not null | PK → ref_qplan_attribute | ref_qplan_attribute.qplan_att_id |
| qplan_index_id | int | not null | PK → ref_qplan_index | ref_qplan_index.qplan_index_id: a filtered index the statement cannot use |
SqlBLT.ref_query_qplan_attribute
Which statement text had which combination, with the first and the last poll at which a request captured had it. The reports find the warnings of a statement through it.
- Rows
- One row per statement text and combination of attributes.
- Written by
SqlBLT.Collect
- Primary key
sqltextid, qplan_att_id, clustered
- Storage
- Not partitioned.
- Indexes
ix_ref_query_qplan_attribute: on qplan_att_id
| Column | Type | Nullable | Key | Definition |
| sqltextid | int | not null | PK → ref_sqltext | ref_sqltext.sqltextid: the statement text of the requests |
| qplan_att_id | int | not null | PK → ref_qplan_attribute | ref_qplan_attribute.qplan_att_id: the combination their plan had |
| first_seen | datetime | not null | | The first poll at which a request captured had the text with the combination |
| last_seen | datetime | not null | | The last poll at which one had; written at most once a minute |
3.4 Aggregates
Samples, sums and maxima of the captured rows per second, minute, hour and day, for each enabled set of dimensions.
SqlBLT.agg_second, SqlBLT.agg_minute, SqlBLT.agg_hour, SqlBLT.agg_day
The aggregates of the captured rows at four grains: the second, the minute, the hour and the day of the poll. For each enabled set of SqlBLT.agg_set, SqlBLT.Aggregate groups the rows of SqlBLT.session_base by the set's dimensions and stores the number of samples and the sums and maxima of wait, elapsed time, CPU time, reads, writes and child waits. A key column of a dimension the set lacks holds -1 (blt holds '-'). The four tables have the same columns.
- Rows
- One row per bucket of time, set and key of the set's dimensions.
- Written by
SqlBLT.Aggregate
- Primary key
set_id, agg_time, blt, database_id, wait_dbname_id, wait_schname_id, wait_objname_id, program_name_id, sqltextid, host_name_id, login_name_id, wait_type_id, qplanid, resource_type_id, request_id, clustered
- Storage
agg_second: partitioned by agg_time on scheme psSqlBLTSecond (function pfSqlBLTSecond): a boundary per day, 14 partitions retained as installed
agg_minute: partitioned by agg_time on scheme psSqlBLTMinute (function pfSqlBLTMinute): a boundary per day, 90 partitions retained as installed
agg_hour: partitioned by agg_time on scheme psSqlBLTHour (function pfSqlBLTHour): a boundary per day, 183 partitions retained as installed
agg_day: partitioned by agg_time on scheme psSqlBLTDay (function pfSqlBLTDay): a boundary per day, 365 partitions retained as installed
Page compression.
| Column | Type | Nullable | Key | Definition |
| agg_time | datetime | not null | PK | The second, minute, hour or day the row covers: the poll times truncated to it; partitioning column |
| set_id | smallint | not null | PK → agg_set | agg_set.set_id |
| database_id | int | not null default -1 | PK → ref_value | Dimension database (bit 1): the session's database; from session_base.conn_db_id; -1 when the set lacks the dimension |
| wait_dbname_id | int | not null default -1 | PK → ref_value | Dimension object (bit 2): the waited resource's database, schema and object; from session_base.wait_dbname_id; -1 when the set lacks the dimension |
| wait_schname_id | int | not null default -1 | PK → ref_value | Dimension object (bit 2): the waited resource's database, schema and object; from session_base.wait_schname_id; -1 when the set lacks the dimension |
| wait_objname_id | int | not null default -1 | PK → ref_value | Dimension object (bit 2): the waited resource's database, schema and object; from session_base.wait_objname_id; -1 when the set lacks the dimension |
| program_name_id | int | not null default -1 | PK → ref_value | Dimension application (bit 4): program_name of the session; from session_base.program_name_id; -1 when the set lacks the dimension |
| sqltextid | int | not null default -1 | PK → ref_sqltext | Dimension query (bit 8): the text template of the statement; from session_base.sqltextid; -1 when the set lacks the dimension |
| host_name_id | int | not null default -1 | PK → ref_value | Dimension host (bit 16): host_name of the session; from session_base.host_name_id; -1 when the set lacks the dimension |
| login_name_id | int | not null default -1 | PK → ref_value | Dimension login (bit 32): login_name of the session; from session_base.login_name_id; -1 when the set lacks the dimension |
| wait_type_id | int | not null default -1 | PK → ref_value | Dimension wait type (bit 64): wait_type of the request; from session_base.wait_type_id; -1 when the set lacks the dimension |
| qplanid | int | not null default -1 | PK → ref_qplan | Dimension plan (bit 128): the plan template of the statement; from session_base.qplanid; -1 when the set lacks the dimension |
| blt | char(1) | not null default '-' | PK | Dimension BLT (bit 256): the row's role at the poll: B blocked, T head blocker, L long running; from session_base.BLT; '-' when the set lacks the dimension |
| resource_type_id | int | not null default -1 | PK → ref_value | Dimension resource type (bit 512): resource_type of the request's wait; from session_base.resource_type_id; -1 when the set lacks the dimension |
| request_id | int | not null default -1 | PK → ref_request | Dimension request (bit 1024): the request: its session and start time (SqlBLT.ref_request); from session_base.session_id, last_req_start_time; -1 when the set lacks the dimension |
| samples | int | not null default 0 | | rows: B, T and L |
| polls_present | int | not null default 0 | | Polls of the row's agg_time interval in which the group had a row |
| sessions_max | int | not null default 0 | | The most rows of the group in one poll |
| session_seconds | bigint | not null default 0 | | Sum of the poll gaps of the rows, in seconds |
| wait_ms | bigint | not null default 0 | | Sum of req_wait_ms_inc: the requests' wait in the poll windows |
| wait_ms_max | bigint | not null default 0 | | The largest wait_time_ms sampled |
| elapsed_ms_max | bigint | not null default 0 | | The largest elapsed_ms sampled |
| cpu_ms | bigint | not null default 0 | | Sum of req_cpu_ms_inc |
| logical_reads | bigint | not null default 0 | | Sum of req_logical_reads_inc |
| physical_reads | bigint | not null default 0 | | Sum of req_phys_reads_inc |
| writes | bigint | not null default 0 | | Sum of req_writes_inc |
| child_wait_ms | bigint | not null default 0 | | Sum of child_wait_ms_inc: the wait of the requests blocked under the rows' sessions, in the poll windows |
| child_wait_ms_max | bigint | not null default 0 | | The largest child_wait_ms sampled |
| stmt_wait_ms | bigint | null | | Sum of stmt_wait_ms_inc; a statement sum is null while no row has added to it |
| stmt_cpu_ms | bigint | null | | Sum of stmt_cpu_ms_inc (first samples by SqlBLT.Aggregate @StatementFirstSampleNull) |
| stmt_logical_reads | bigint | null | | Sum of stmt_logical_reads_inc (likewise) |
| stmt_physical_reads | bigint | null | | Sum of stmt_phys_reads_inc (likewise) |
| stmt_writes | bigint | null | | Sum of stmt_writes_inc (likewise) |
SqlBLT.agg_set
The sets of dimensions that are aggregated, and the grains each set is stored at. set_id is the sum of the bits of the set's dimensions. A set with enabled = 0 is not computed from the next batch on.
- Rows
- One row per set: 15 rows as installed.
- Written by
- The install script; a DBA may add or disable sets
- Primary key
set_id, clustered
- Storage
- Not partitioned.
- Checks
ck_agg_set_bits: set_id = has_database * 1 + has_object * 2 + has_application * 4 + has_query * 8 + has_host * 16 + has_login * 32 + has_wait_type * 64 + has_plan * 128 + has_blt * 256 + has_resource_type * 512 + has_request * 1024
| Column | Type | Nullable | Key | Definition |
| set_id | smallint | not null | PK | The sum of the bits of the set's dimensions |
| name | varchar(60) | not null | | The name of the set |
| has_database | bit | not null | | 1 = the set has the dimension database (bit 1) |
| has_object | bit | not null | | 1 = the set has the dimension object (bit 2) |
| has_application | bit | not null | | 1 = the set has the dimension application (bit 4) |
| has_query | bit | not null | | 1 = the set has the dimension query (bit 8) |
| has_host | bit | not null | | 1 = the set has the dimension host (bit 16) |
| has_login | bit | not null | | 1 = the set has the dimension login (bit 32) |
| has_wait_type | bit | not null | | 1 = the set has the dimension wait type (bit 64) |
| has_plan | bit | not null | | 1 = the set has the dimension plan (bit 128) |
| has_blt | bit | not null | | 1 = the set has the dimension BLT (bit 256) |
| has_resource_type | bit | not null | | 1 = the set has the dimension resource type (bit 512) |
| has_request | bit | not null | | 1 = the set has the dimension request (bit 1024) |
| at_second | bit | not null | | 1 = the set is stored in SqlBLT.agg_second |
| at_minute | bit | not null | | 1 = the set is stored in SqlBLT.agg_minute |
| at_hour | bit | not null | | 1 = the set is stored in SqlBLT.agg_hour |
| at_day | bit | not null | | 1 = the set is stored in SqlBLT.agg_day |
| enabled | bit | not null | | 0 = not computed from the next batch on |
| description | varchar(200) | not null default '' | | A note on the set |
SqlBLT.agg_dimension
The dimensions a set is made of: the key columns of each in the aggregate tables, its source columns in SqlBLT.session_base and the table that renders a key.
- Rows
- One row per dimension: 11 rows.
- Written by
- The install script
- Primary key
bit, clustered
- Storage
- Not partitioned.
| Column | Type | Nullable | Key | Definition |
| bit | smallint | not null | PK | The dimension's bit; a set's set_id is the sum of the bits of its dimensions |
| name | varchar(20) | not null | | The name of the dimension |
| key_columns | varchar(60) | not null | | The key column(s) in the aggregate tables |
| source_columns | varchar(60) | not null | | In SqlBLT.session_base |
| ref_table | varchar(20) | not null | | Where a key is rendered: ref_value, ref_sqltext or ref_qplan |
| ref_attributes | varchar(20) | not null | | ref_type.bpat_id of the dictionary attribute(s); '' for a store table |
| description | varchar(200) | not null | | What the dimension is |
3.5 Metrics
The 115 metrics of metric, sampled at every run and aggregated per minute, hour and day.
SqlBLT.metric
The metrics that SqlBLT.CollectMetrics collects and the reports show: a wait type group, a performance counter, CPU, the schedulers, memory, sessions and requests, tempdb space or file IO per database. kind says how a value is stored: G a gauge as sampled, D the growth of a cumulative value since the previous run, A the growth of a value over the growth of its base.
- Rows
- One row per metric: 115 rows as installed.
- Written by
- The install script; a DBA may add or disable metrics
- Primary key
metric_id, clustered
- Storage
- Not partitioned.
- Checks
ck_metric_kind: kind in ('G', 'D', 'A')
ck_metric_source: source in ('W', 'X', 'C', 'R', 'A', 'S', 'M', 'Q', 'T', 'F')
| Column | Type | Nullable | Key | Definition |
| metric_id | smallint | not null | PK | The id of the metric |
| name | nvarchar(128) | not null | | As the reports show it |
| category | varchar(16) | not null | | wait, counter, cpu, scheduler, memory, session, tempdb, io |
| source | char(1) | not null | | W, X, C, R, A, S, M, Q, T, F (see above) |
| kind | char(1) | not null | | G gauge, D delta, A average |
| unit | varchar(16) | not null | | ms, /s (a delta per second), count, %, KB, MB, pages, s |
| pattern | nvarchar(128) | null | | W: the LIKE pattern of the wait types summed |
| object_name | nvarchar(128) | null | | C: the counter object after SQLServer: or MSSQL$name: |
| counter_name | nvarchar(128) | null | | C: the counter |
| instance_name | nvarchar(128) | null | | C: its instance ('' for none, _Total); null = every instance of the counter, summed |
| base_counter | nvarchar(128) | null | | C: the base counter of a ratio (G) or average (A) |
| per_database | bit | not null default 0 | | F: one row per database, scope_id = database_id |
| enabled | bit | not null default 1 | | Collected |
| shown | bit | not null default 0 | | In the reports' default band |
| sort_order | smallint | not null default 0 | | Its place in the reports' list |
| description | nvarchar(400) | not null default '' | | What the metric shows |
SqlBLT.metric_base
The metric samples. A per-database metric (file IO) has one row per database, with scope_id the database_id; every other metric has scope_id 0.
- Rows
- One row per run, metric and scope.
- Written by
SqlBLT.CollectMetrics
- Primary key
now, metric_id, scope_id, clustered
- Storage
- Partitioned by
now on scheme psSqlBLTMetric (function pfSqlBLTMetric): a boundary per day, 14 partitions retained as installed. Page compression.
| Column | Type | Nullable | Key | Definition |
| now | datetime | not null | PK | The run; partitioning column (psSqlBLTMetric) |
| metric_id | smallint | not null | PK → metric | The metric |
| scope_id | int | not null default 0 | PK → metric_scope | 0, or the database_id of a per-database metric |
| value | float | not null | | G: the value sampled; D: the growth over the interval; A: the average over the interval |
| seconds | int | not null default 0 | | D and A: the interval the value covers |
SqlBLT.metric_minute, SqlBLT.metric_hour, SqlBLT.metric_day
The metric aggregates per minute, hour and day: the number of samples, their seconds, and the sum, minimum, maximum and last value. The rate of a D or A metric at a grain is value_sum / seconds; the average of a gauge is value_sum / samples. The three tables have the same columns.
- Rows
- One row per bucket of time, metric and scope.
- Written by
SqlBLT.AggregateMetrics
- Primary key
metric_id, scope_id, agg_time, clustered
- Storage
metric_minute: partitioned by agg_time on scheme psSqlBLTMetricMinute (function pfSqlBLTMetricMinute): a boundary per day, 90 partitions retained as installed
metric_hour: partitioned by agg_time on scheme psSqlBLTMetricHour (function pfSqlBLTMetricHour): a boundary per day, 183 partitions retained as installed
metric_day: partitioned by agg_time on scheme psSqlBLTMetricDay (function pfSqlBLTMetricDay): a boundary per day, 365 partitions retained as installed
Page compression.
| Column | Type | Nullable | Key | Definition |
| agg_time | datetime | not null | PK | The minute, hour or day the row covers; partitioning column |
| metric_id | smallint | not null | PK → metric | The metric |
| scope_id | int | not null | PK → metric_scope | 0, or the database_id of a per-database metric |
| samples | int | not null | | Rows of metric_base |
| seconds | int | not null | | Their intervals summed (D and A) |
| value_sum | float | not null | | Sum of the values |
| value_min | float | not null | | The smallest value |
| value_max | float | not null | | The largest value |
| value_last | float | not null | | The value of the latest run |
SqlBLT.metric_scope
The databases of the per-database metrics, with their names, so that a restored copy still names them.
- Rows
- One row per database that a per-database metric has seen.
- Written by
SqlBLT.CollectMetrics
- Primary key
scope_id, clustered
- Storage
- Not partitioned.
- Checks
ck_metric_scope_none: scope_id = 0 or (name is not null and first_seen is not null and last_seen is not null)
| Column | Type | Nullable | Key | Definition |
| scope_id | int | not null | PK | The database_id of a per-database metric; 0 = the instance: the scope of the other metrics |
| name | sysname | null | | Its name, kept so that a restored copy still names it; null in the row of scope 0 alone |
| first_seen | datetime | null | | The first run that saw the database |
| last_seen | datetime | null | | The last run that saw it |
SqlBLT.metric_state
The cumulative values of the previous run, from which the next run computes the growth. The table is emptied when the instance has restarted or the previous run is older than the setting MaxIntervalSeconds, so that the next run stores no deltas.
- Rows
- One row per metric and scope that has a cumulative value, and the row (0, 0) of the run.
- Written by
SqlBLT.CollectMetrics
- Primary key
metric_id, scope_id, clustered
- Storage
- Not partitioned.
| Column | Type | Nullable | Key | Definition |
| metric_id | smallint | not null | PK | 0 with scope 0: the previous run (sampled) and the instance start time (raw) |
| scope_id | int | not null | PK | 0, or the database_id of a per-database metric |
| sampled | datetime | not null | | Time of the sample |
| raw | float | null | | The cumulative value sampled |
| raw_base | float | null | | The base of that value, for an average |
SqlBLT.metric_wait_skip
LIKE patterns of benign wait types, which are left out of the wait totals.
- Rows
- One row per pattern: 41 rows as installed.
- Written by
- The install script
- Primary key
pattern, clustered
- Storage
- Not partitioned.
| Column | Type | Nullable | Key | Definition |
| pattern | nvarchar(128) | not null | PK | A LIKE pattern of benign wait types, left out of the totals |
SqlBLT.metric_agg_polls, SqlBLT.metric_agg_rows
Memory-optimized tables (durability SCHEMA_ONLY) in which SqlBLT.AggregateMetrics stages a batch when its setting InMemoryWorkTables is 1: SqlBLT.metric_agg_polls holds the runs of the batch, each with its three buckets and the run's interval, and SqlBLT.metric_agg_rows the aggregated rows. The procedure creates them when they are missing, which needs a MEMORY_OPTIMIZED_DATA filegroup; the install script does not create them. The next batch empties them.
- Rows
- Rows of the batch in progress only.
- Written by
SqlBLT.AggregateMetrics
metric_agg_polls | Type | Nullable | Key | Definition |
| poll | datetime | not null | PK | The run |
| grain | tinyint | not null | PK | The grain of the bucket |
| agg_time | datetime | not null | | The bucket the run falls in |
| seconds | int | not null | | The interval of the run |
metric_agg_rows | Type | Nullable | Key | Definition |
| grain | tinyint | not null | PK | The grain of the bucket |
| agg_time | datetime | not null | PK | The bucket |
| metric_id | smallint | not null | PK | The metric |
| scope_id | int | not null | PK | 0, or the database_id of a per-database metric |
| samples | int | not null | | Rows of SqlBLT.metric_base |
| seconds | int | not null | | Their intervals summed |
| value_sum | float | not null | | Sum of the values |
| value_min | float | not null | | The smallest value |
| value_max | float | not null | | The largest value |
| last_now | datetime | not null | | The latest run of the bucket in the batch |
| value_last | float | null | | The value of that run |
3.6 Config
The settings of the procedures, the boundary period and the retention of each partition function, and the versions installed.
SqlBLT.config_setting
The settings of SqlBLT.Collect, SqlBLT.CollectMetrics, SqlBLT.Aggregate, SqlBLT.AggregateMetrics and SqlBLT.MaintainPartitions: one row per parameter of the procedure. A parameter that an execution does not pass takes the value of its row, read at the start of every execution, so a change applies from the next one; the job steps pass none. A parameter that is passed applies to that execution alone.
- Rows
- One row per setting: 30 rows.
- Written by
- The install script; a DBA sets the values
- Primary key
procedure_name, setting_name, clustered
- Storage
- Not partitioned.
- Checks
ck_config_setting_value: value between min_value and max_value
| Column | Type | Nullable | Key | Definition |
| procedure_name | sysname | not null | PK | Collect, CollectMetrics, Aggregate, AggregateMetrics or MaintainPartitions |
| setting_name | sysname | not null | PK | The procedure's parameter of this name, without the @ |
| value | bigint | not null | | What the procedure runs with when the parameter is not passed |
| min_value | bigint | not null | | The lowest and |
| max_value | bigint | not null | | The highest value the setting takes |
| description | nvarchar(400) | not null | | What the setting does |
SqlBLT.config_partition
The boundary period, the number of future boundaries and the number of partitions retained of each partition function. SqlBLT.MaintainPartitions reads the table once a day, so a change takes effect at its next run; a change of boundary_period applies to the boundaries added from then on.
- Rows
- One row per partition function: 9 rows.
- Written by
- The install script; a DBA sets the values
- Primary key
function_name, clustered
- Storage
- Not partitioned.
- Checks
ck_config_partition_function: function_name in (N'pfSqlBLT', N'pfSqlBLTSecond', N'pfSqlBLTMinute', N'pfSqlBLTHour', N'pfSqlBLTDay', N'pfSqlBLTMetric', N'pfSqlBLTMetricMinute', N'pfSqlBLTMetricHour', N'pfSqlBLTMetricDay')
ck_config_partition_boundary_period: boundary_period in ('day', 'month', 'year')
ck_config_partition_future_boundaries: future_boundaries between 1 and 1000
ck_config_partition_partitions_retained: partitions_retained between 0 and 13000
| Column | Type | Nullable | Key | Definition |
| function_name | sysname | not null | PK | The partition function |
| boundary_period | varchar(5) | not null | | The period from one boundary to the next: day, month or year |
| future_boundaries | int | not null | | The number of boundaries kept ahead of now |
| partitions_retained | int | not null | | The number of partitions before the current one that keep their rows; 0 = every partition is kept |
SqlBLT.config_version
The SqlBLT versions installed in the database: the installation and each upgrade. The latest row is the version that the procedures record in their log rows.
- Rows
- One row per version installed.
- Written by
- The install and upgrade scripts
- Primary key
version, clustered
- Storage
- Not partitioned.
| Column | Type | Nullable | Key | Definition |
| version | char(13) | not null | PK | The SqlBLT version installed; the latest by installed is what SqlBLT.Collect, Aggregate and MaintainPartitions record in their log rows |
| installed | datetime | not null | | When it was installed, or upgraded to |
| upgraded_from | char(13) | null | | The version an upgrade replaced; null for a fresh installation |
3.7 Logging
One row per poll, metrics run, aggregation batch and maintenance execution, with its timings and outcome; the errors.
SqlBLT.log_capture
The polls of SqlBLT.Collect. The row is written after the poll's SqlBLT.session_base rows, so a poll in this table is complete. It holds the number of rows, the duration, the time of each phase and the texts and plans fetched and parsed.
- Rows
- One row per poll.
- Written by
SqlBLT.Collect
- Primary key
now, clustered
- Storage
- Not partitioned: the rows are kept.
| Column | Type | Nullable | Key | Definition |
| now | datetime | not null | PK | Time of the poll: the now of its SqlBLT.session_base rows |
| version | char(13) | not null | | The SqlBLT version that ran the poll |
| rows_returned | int | not null | | Rows of the poll: B, T and L |
| duration_ms | int | not null | | Duration of the poll |
| ms_classify | int | null | | Classification read (B, T, L rows) |
| ms_detail | int | null | | Detail read of sessions, requests, connections |
| ms_resolve | int | null | | Resource parsing and catalog resolution |
| ms_cache | int | null | | Text and plan fetches |
| ms_capture | int | null | | increments, insert into the capture view (trigger: dictionary values, key mapping, session_base rows), request state; without ms_missing_index and ms_qplan_attribute |
| cycles | int | null | | B rows that reach no head blocker (a blocking cycle), not reported as B rows |
| ms_text_fetch | int | null | | Text fetch and raw hashing (part of ms_cache) |
| ms_plan_fetch | int | null | | Plan fetch and raw hashing (part of ms_cache) |
| plans_fetched | int | null | | Distinct (plan_handle, offsets) keys fetched |
| plans_skipped | int | null | | Distinct keys not parsed or stored again: their query_plan_hash already has a template (@QPlanSkipStorageOfKnownHashes = 1); with @QPlanLogAttributes = 1 they are fetched all the same |
| texts_parsed | int | null | | Texts passed through the SQL parser (raw hashes not seen before) |
| text_chars_parsed | int | null | | Their characters |
| ms_text_parse | int | null | | Their templating time |
| plans_parsed | int | null | | Plans passed through the plan parser (raw hashes not seen before) |
| plan_chars_parsed | int | null | | Their characters |
| plan_chars_max | int | null | | The largest of them |
| ms_plan_parse | int | null | | Their templating time, one plan at a time |
| ms_plan_parse_max | int | null | | The slowest of them |
| ms_store | int | null | | Template hashing, compression and the ref_sqltext, ref_qplan, key and hash inserts |
| window_ms | int | null | | The poll's window: milliseconds since the previous poll, at most @MaxPollGapSeconds |
| ms_missing_index | int | null | | The missing index recommendations: their read (the view, or the plans fetched) and their store; null with @CaptureMissingIndexes = 0 |
| missing_indexes | int | null | | The recommendations of the queries of the poll: the rows the view holds for them, or without the view the rows stored for them; null with @CaptureMissingIndexes = 0 |
| ms_qplan_attribute | int | null | | The attributes of the query plans: their read from the plans fetched and their store; null with @QPlanLogAttributes = 0 |
SqlBLT.log_capture_error
The lookups that failed or were skipped during a poll, each with the step (pass), the database, the error and the captured row it belongs to. The poll completes without the value looked up.
- Rows
- One row per lookup of a poll that failed or was skipped.
- Written by
SqlBLT.Collect
- Primary key
now, id, clustered
- Storage
- Not partitioned: the rows are kept.
| Column | Type | Nullable | Key | Definition |
| now | datetime | not null | PK | The poll |
| id | int | not null | PK | Number of the entry within the poll |
| pass | char(2) | not null | | The step: p1 a page lookup failed; p2 a page lookup was skipped, the setting PageIOLatchLookupBudgetMS being spent; h1, a1, o1 the lookup of the waited object by HoBT, allocation unit or object id failed; f1 the lookup of the waited file failed; n1 the lookups in the database failed; s1 the database is not accessible; i1 the input buffer could not be read; v1 text and plan not fetched (SQL Server 2016 or later is required) |
| dbid | int | null | | The database of the lookup |
| error_number | int | null | | error_number() of the failure; 0 for a lookup that was skipped |
| error_message | nvarchar(2048) | null | | error_message() of the failure, or the reason of the skip |
| session_row_id | int | null | | row_id of the SqlBLT.session_base row concerned |
| session_id | int | null | | Its session |
| BLT | char(1) | null | | Its role: B, T or L |
SqlBLT.log_aggregate
The batches of SqlBLT.Aggregate: the polls of each batch, the rows read and the rows written at each grain, the phase times and the outcome. The polls_to of the last completed batch is where the next batch starts.
- Rows
- One row per batch.
- Written by
SqlBLT.Aggregate
- Primary key
aggregate_id, clustered
- Storage
- Not partitioned: the rows are kept.
| Column | Type | Nullable | Key | Definition |
| aggregate_id | int | not null identity | PK | The batch |
| started | datetime | not null | | Start of the batch |
| ended | datetime | null | | null until the batch ends |
| version | char(13) | not null | | The SqlBLT version that ran it |
| polls_from | datetime | not null | | The batch window: the polls of SqlBLT.log_capture from this time |
| polls_to | datetime | not null | | The batch window: the polls up to this time; the polls_to of the last completed batch is where the next batch starts |
| polls | int | not null | | Polls in the batch |
| rows_read | int | null | | session_base rows of the window |
| rows_second | int | null | | Rows updated or inserted in SqlBLT.agg_second |
| rows_minute | int | null | | Rows updated or inserted in SqlBLT.agg_minute |
| rows_hour | int | null | | Rows updated or inserted in SqlBLT.agg_hour |
| rows_day | int | null | | Rows updated or inserted in SqlBLT.agg_day |
| ms_read | int | null | | Time to read the SqlBLT.session_base rows |
| ms_group | int | null | | Time to group them |
| ms_write | int | null | | Time to write the aggregate tables |
| outcome | varchar(10) | not null default '' | | started, completed, failed |
| error_message | nvarchar(2048) | null | | The error message of a failed batch |
| ms_total | int | null | | Milliseconds from started to ended |
SqlBLT.log_metrics
The runs of SqlBLT.CollectMetrics: the rows written, the interval since the previous run, the duration and the time of each phase.
- Rows
- One row per run.
- Written by
SqlBLT.CollectMetrics
- Primary key
now, clustered
- Storage
- Not partitioned: the rows are kept.
| Column | Type | Nullable | Key | Definition |
| now | datetime | not null | PK | The run |
| version | char(13) | not null | | The SqlBLT version that ran it |
| rows_written | int | not null | | Rows written to SqlBLT.metric_base |
| seconds | int | null | | The interval since the previous run; null when no deltas were stored |
| duration_ms | int | not null | | Duration of the run |
| waits | int | not null | | Wait type groups read |
| counters | int | not null | | Performance counters read |
| io_rows | int | not null | | File IO rows read |
| ms_waits | int | null | | Time of the phase: the wait statistics |
| ms_counters | int | null | | Time of the phase: the counters |
| ms_other | int | null | | Time of the phase: the other sources |
| ms_io | int | null | | Time of the phase: the file IO and the scopes |
| ms_store | int | null | | Time of the phase: the store |
SqlBLT.log_metrics_aggregate
The batches of SqlBLT.AggregateMetrics: the runs of each batch, the rows read and the rows written at each grain, and the outcome.
- Rows
- One row per batch.
- Written by
SqlBLT.AggregateMetrics
- Primary key
aggregate_id, clustered
- Storage
- Not partitioned: the rows are kept.
| Column | Type | Nullable | Key | Definition |
| aggregate_id | int | not null identity | PK | The batch |
| started | datetime | not null | | Start of the batch |
| ended | datetime | null | | null until the batch ends |
| version | char(13) | not null | | The SqlBLT version that ran it |
| polls_from | datetime | not null | | The batch window: the runs of SqlBLT.log_metrics from this time |
| polls_to | datetime | not null | | The batch window: the runs up to this time |
| polls | int | not null | | Runs in the batch |
| rows_read | int | null | | SqlBLT.metric_base rows of the window |
| rows_minute | int | null | | Rows updated or inserted in SqlBLT.metric_minute |
| rows_hour | int | null | | Rows updated or inserted in SqlBLT.metric_hour |
| rows_day | int | null | | Rows updated or inserted in SqlBLT.metric_day |
| outcome | varchar(10) | not null default '' | | started, completed, failed |
| error_message | nvarchar(2048) | null | | The error message of a failed batch |
| ms_total | int | null | | Milliseconds from started to ended |
SqlBLT.log_metrics_error
The runs of SqlBLT.CollectMetrics that failed. Such a run writes no row to SqlBLT.log_metrics.
- Rows
- One row per run that failed.
- Written by
SqlBLT.CollectMetrics, for a run that failed
- Primary key
now, clustered
- Storage
- Not partitioned: the rows are kept.
| Column | Type | Nullable | Key | Definition |
| now | datetime | not null | PK | The run of SqlBLT.CollectMetrics that failed: it wrote no row to SqlBLT.log_metrics |
| error_number | int | null | | error_number() of the failure |
| error_message | nvarchar(2048) | null | | error_message() of the failure |
SqlBLT.log_maintenance
The executions of SqlBLT.MaintainPartitions that did the daily work, each with its outcome and totals. The procedure reads this table to decide whether the work of the day is done; an execution that exits at once writes no row.
- Rows
- One row per execution that did the daily work.
- Written by
SqlBLT.MaintainPartitions
- Primary key
maint_id, clustered
- Storage
- Not partitioned: the rows are kept.
| Column | Type | Nullable | Key | Definition |
| maint_id | int | not null identity | PK | The execution |
| started | datetime | not null | | Start of the execution; the daily gate of SqlBLT.MaintainPartitions reads it |
| ended | datetime | null | | null while the execution runs, and when it ended without recording its outcome |
| version | char(13) | not null | | The SqlBLT version that ran it |
| outcome | varchar(10) | not null default '' | | started, completed, failed |
| error_message | nvarchar(2048) | null | | The error message of a failed execution |
| ms_total | int | null | | Milliseconds from started to ended |
| boundaries_split | int | null | | Boundaries added: each one a new partition |
| partitions_truncated | int | null | | Partitions truncated |
| boundaries_merged | int | null | | Boundaries removed: each one an empty partition joined to its neighbour |
| rows_truncated | bigint | null | | Rows of the partitions truncated |
| sqltext_deleted | int | null | | ref_sqltext rows deleted, each with its ref_sqltext_key rows |
| qplans_deleted | int | null | | ref_qplan rows deleted, each with its ref_qplan_key and ref_qplan_hash rows |
| ref_rebuild_ms | int | null | | The reference counts were rebuilt from the rows: its time; null = no rebuild |
| ref_counts_corrected | int | null | | By that rebuild: the counts that differed from the rows; null = no rebuild |
SqlBLT.log_maintenance_partition
The partitions an execution of SqlBLT.MaintainPartitions worked on: a partition created by a split, a partition truncated, a partition whose boundary was merged away. The truncation of a partition and the merge of its boundary are one row.
- Rows
- One row per partition an execution worked on.
- Written by
SqlBLT.MaintainPartitions
- Primary key
maint_id, part_id, clustered
- Storage
- Not partitioned: the rows are kept.
| Column | Type | Nullable | Key | Definition |
| maint_id | int | not null | PK → log_maintenance | log_maintenance.maint_id |
| part_id | int | not null | PK | 1, 2, 3 ... within the execution, in the order of the work |
| function_name | sysname | not null | | The partition function |
| table_name | sysname | null | | The table truncated; for a split or a merge the table of the function, null when the function has several |
| range_from | datetime | null | | The partition: from this boundary, which a split added and a merge removed; null for the first partition |
| range_to | datetime | null | | The partition: up to, excluding, this boundary; null for the last partition |
| split_ms | int | null | | The partition was created by a split: its time; null = no split |
| truncate_ms | int | null | | The partition was truncated: its time, with the count of its references and their removal from SqlBLT.ref_counts; null = no truncation |
| rows_truncated | bigint | null | | Rows of the partition truncated |
| sqltext_deleted | int | null | | Not used: the texts are deleted after the retention, and SqlBLT.log_maintenance counts them |
| qplans_deleted | int | null | | Not used: the plans are deleted after the retention, and SqlBLT.log_maintenance counts them |
| merge_ms | int | null | | The boundary at range_from was merged away: its time; null = no merge |
3.8 Size
The size log: the size of every table and of each daily partition that holds rows, logged once a day by the daily maintenance, and the data type of each table.
SqlBLT.size_type
The data types of the size log: the kinds of data whose size is followed. sqltext is the statement texts and qplantext the query plans; blt is the captured rows and their aggregates, and metric the metric samples and their aggregates, each with one row per grain: base for the rows as captured, then second, minute, hour and day. The rows of one typename sum to its total.
- Rows
- One row per data type: 11 rows.
- Written by
- The install script
- Primary key
typeid, clustered
- Storage
- Not partitioned.
| Column | Type | Nullable | Key | Definition |
| typeid | smallint | not null | PK | The data type |
| typename | varchar(20) | not null | | The kind of data: sqltext, qplantext, blt or metric |
| grain | varchar(10) | null | | Of blt and metric: base (the rows as captured), second, minute, hour or day |
SqlBLT.size_object
The tables of the size log, each with its data type, so that a logged size carries objid and never a name. A table that holds none of these kinds of data (a dictionary, a log, configuration, state) has no type. SqlBLT.MaintainPartitions adds a table that is not named here yet, without a type.
- Rows
- One row per table: 52 rows as installed.
- Written by
- The install script;
SqlBLT.MaintainPartitions adds a table it does not name yet
- Primary key
objid, clustered
- Storage
- Not partitioned.
- Indexes
ux_size_object: unique, on objname
| Column | Type | Nullable | Key | Definition |
| objid | smallint | not null | PK | The table: the id that a logged size carries |
| objname | sysname | not null | | The table, without the schema |
| typeid | smallint | null | → size_type | size_type.typeid: the table's data type; null = none |
SqlBLT.size_table
The size of every table, logged once a day by SqlBLT.MaintainPartitions after its partition work: the rows and, in KB, the space reserved, the data, the indexes and the unused space, counted as sp_spaceused counts them, so that reserved_kb = data_kb + index_kb + unused_kb. maint_id is the execution, whose time SqlBLT.log_maintenance has. A memory-optimized table is not logged.
- Rows
- One row per table, per execution of the daily maintenance.
- Written by
SqlBLT.MaintainPartitions, once a day
- Primary key
maint_id, objid, clustered
- Storage
- Not partitioned: the rows are kept. Page compression.
| Column | Type | Nullable | Key | Definition |
| maint_id | int | not null | PK → log_maintenance | log_maintenance.maint_id: the execution that logged the size |
| objid | smallint | not null | PK → size_object | size_object.objid |
| rows | bigint | not null | | Rows of the table |
| reserved_kb | bigint | not null | | The space allocated to the table and its indexes |
| data_kb | bigint | not null | | Of it: the rows, with their large values |
| index_kb | bigint | not null | | The indexes |
| unused_kb | bigint | not null | | Allocated and not used yet |
SqlBLT.size_partition
The size of each partition of the partitioned tables, logged with SqlBLT.size_table: with a boundary per day, the size of the data retained for each day. part_id numbers the partitions of a table that hold rows, the oldest first; range_from and range_to are the boundaries of the partition. The partitions of a table sum to its row in SqlBLT.size_table.
- Rows
- One row per partition that holds rows, per table and execution of the daily maintenance.
- Written by
SqlBLT.MaintainPartitions, once a day
- Primary key
maint_id, objid, part_id, clustered
- Storage
- Not partitioned: the rows are kept. Page compression.
| Column | Type | Nullable | Key | Definition |
| maint_id | int | not null | PK → log_maintenance | log_maintenance.maint_id: the execution that logged the size |
| objid | smallint | not null | PK → size_object | size_object.objid |
| part_id | smallint | not null | PK | 1, 2, 3 ... within the table: its partitions that hold rows, the oldest first |
| range_from | datetime | null | | The partition: from this boundary; null for the first partition |
| range_to | datetime | null | | Up to, excluding, this one; null for the last partition |
| rows | bigint | not null | | Rows of the partition |
| reserved_kb | bigint | not null | | The space allocated to the partition |
| data_kb | bigint | not null | | Of it: the rows, with their large values |
| index_kb | bigint | not null | | The indexes |
| unused_kb | bigint | not null | | Allocated and not used yet |
4. Views
SqlBLT.sessions
The captured rows of SqlBLT.session_base with every dictionary id rendered as its value and the text and plan templates rendered. SqlBLT.Collect inserts through this view: its INSTEAD OF INSERT trigger SqlBLT.tr_sessions hands the rows to SqlBLT.load_sessions, which adds new dictionary values, stores new templates and writes the SqlBLT.session_base rows.
| Column | Type | Nullable | Expression |
| id | int | not null | SqlBLT.session_base.row_id |
| BLT | char(1) | null | SqlBLT.session_base.BLT |
| session_id | smallint | null | SqlBLT.session_base.session_id |
| blocked | smallint | null | SqlBLT.session_base.blocked |
| topblock | int | null | SqlBLT.session_base.topblock |
| req_status | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.req_status_id |
| session_status | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.session_status_id |
| open_trans | int | null | SqlBLT.session_base.open_trans |
| elapsed_ms | bigint | null | SqlBLT.session_base.elapsed_ms |
| wait_time_ms | bigint | null | SqlBLT.session_base.wait_time_ms |
| req_cpu_ms | bigint | null | SqlBLT.session_base.req_cpu_ms |
| req_logical_reads | bigint | null | SqlBLT.session_base.req_logical_reads |
| req_phys_reads | bigint | null | SqlBLT.session_base.req_phys_reads |
| req_writes | bigint | null | SqlBLT.session_base.req_writes |
| mem_used | bigint | null | SqlBLT.session_base.mem_used |
| command | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.command_id |
| conn_dbid | int | null | SqlBLT.session_base.conn_dbid |
| conn_db | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.conn_db_id |
| auth_dbid | int | null | SqlBLT.session_base.auth_dbid |
| auth_db | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.auth_db_id |
| sqltext_source | char(1) | null | SqlBLT.session_base.sqltext_source |
| sqltext_objname | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.sqltext_objname_id |
| wait_dbid | bigint | null | SqlBLT.session_base.wait_dbid |
| wait_dbname | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.wait_dbname_id |
| wait_schname | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.wait_schname_id |
| wait_objname | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.wait_objname_id |
| wait_object_type | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.wait_object_type_id |
| wait_index_id | int | null | SqlBLT.session_base.wait_index_id |
| wait_indexname | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.wait_indexname_id |
| wait_partition_number | int | null | SqlBLT.session_base.wait_partition_number |
| wait_filename | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.wait_filename_id |
| wait_filepath | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.wait_filepath_id |
| wait_object_id | bigint | null | SqlBLT.session_base.wait_object_id |
| wait_file_id | bigint | null | SqlBLT.session_base.wait_file_id |
| wait_resource | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.wait_resource_id |
| last_wait_type | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.last_wait_type_id |
| now | datetime | not null | SqlBLT.session_base.now |
| connect_time | datetime | null | SqlBLT.session_base.connect_time |
| last_req_end_time | datetime | null | SqlBLT.session_base.last_req_end_time |
| last_req_start_time | datetime | null | SqlBLT.session_base.last_req_start_time |
| wait_type | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.wait_type_id |
| task_wait_type | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.task_wait_type_id |
| task_wait_ms | bigint | null | SqlBLT.session_base.task_wait_ms |
| is_user | bit | not null | SqlBLT.session_base.is_user |
| req_mode | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.req_mode_id |
| tran_begin_time | datetime | null | SqlBLT.session_base.tran_begin_time |
| ms_since_tran_begin_time | bigint | null | SqlBLT.session_base.ms_since_tran_begin_time |
| tran_name | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.tran_name_id |
| is_implicit_tran | smallint | null | SqlBLT.session_base.is_implicit_tran |
| resource_type | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.resource_type_id |
| resource_subtype | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.resource_subtype_id |
| resource_description | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.resource_descr_id |
| resource_associated_entity_id | bigint | null | SqlBLT.session_base.resource_associated_entity_id |
| resource_lock_partition | int | null | SqlBLT.session_base.resource_lock_partition |
| statement_start_offset | int | null | SqlBLT.session_base.statement_start_offset |
| statement_end_offset | int | null | SqlBLT.session_base.statement_end_offset |
| query_hash | binary(8) | null | SqlBLT.session_base.query_hash |
| query_plan_hash | binary(8) | null | SqlBLT.session_base.query_plan_hash |
| host_name | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.host_name_id |
| program_name | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.program_name_id |
| host_process_id | int | null | SqlBLT.session_base.host_process_id |
| client_version | bigint | null | SqlBLT.session_base.client_version |
| client_interface_name | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.client_interface_id |
| login_name | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.login_name_id |
| tran_isolation_level | smallint | null | SqlBLT.session_base.tran_isolation_level |
| lock_timeout | int | null | SqlBLT.session_base.lock_timeout |
| deadlock_priority | int | null | SqlBLT.session_base.deadlock_priority |
| net_transport | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.net_transport_id |
| protocol_type | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.protocol_type_id |
| protocol_version | int | null | SqlBLT.session_base.protocol_version |
| encrypt_option | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.encrypt_option_id |
| auth_scheme | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.auth_scheme_id |
| node_affinity | smallint | null | SqlBLT.session_base.node_affinity |
| conn_packet_reads | bigint | null | SqlBLT.session_base.conn_packet_reads |
| conn_packet_writes | bigint | null | SqlBLT.session_base.conn_packet_writes |
| conn_last_read | datetime | null | SqlBLT.session_base.conn_last_read |
| conn_last_write | datetime | null | SqlBLT.session_base.conn_last_write |
| net_packet_size | int | null | SqlBLT.session_base.net_packet_size |
| client_net_address | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.client_net_addr_id |
| client_tcp_port | int | null | SqlBLT.session_base.client_tcp_port |
| local_net_address | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.local_net_addr_id |
| local_tcp_port | int | null | SqlBLT.session_base.local_tcp_port |
| sql_handle | varbinary(64) | null | SqlBLT.session_base.sql_handle |
| secs_since_last_req_end | bigint | null | SqlBLT.session_base.secs_since_last_req_end |
| isdbccpage | smallint | null | SqlBLT.session_base.isdbccpage |
| waittype | binary(2) | null | SqlBLT.session_base.waittype |
| qplan_key | char(18) | null | SqlBLT.session_base.qplan_key |
| plan_handle | varbinary(64) | null | SqlBLT.session_base.plan_handle |
| sqltext_chash | varchar(88) | null | SqlBLT.ref_sqltext.sqltext_chash, through session_base.sqltextid |
| qplan_chash | varchar(88) | null | SqlBLT.ref_qplan.qplan_chash, through session_base.qplanid |
| percent_complete | decimal(5,2) | null | SqlBLT.session_base.percent_complete |
| est_completion_time | bigint | null | SqlBLT.session_base.est_completion_time |
| pass | char(2) | null | SqlBLT.session_base.pass |
| error_number | int | null | SqlBLT.session_base.error_number |
| error_message | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through session_base.error_message_id |
| req_wait_ms_inc | bigint | null | SqlBLT.session_base.req_wait_ms_inc |
| req_cpu_ms_inc | bigint | null | SqlBLT.session_base.req_cpu_ms_inc |
| req_logical_reads_inc | bigint | null | SqlBLT.session_base.req_logical_reads_inc |
| req_phys_reads_inc | bigint | null | SqlBLT.session_base.req_phys_reads_inc |
| req_writes_inc | bigint | null | SqlBLT.session_base.req_writes_inc |
| stmt_wait_ms_inc | bigint | null | SqlBLT.session_base.stmt_wait_ms_inc |
| stmt_cpu_ms_inc | bigint | null | SqlBLT.session_base.stmt_cpu_ms_inc |
| stmt_logical_reads_inc | bigint | null | SqlBLT.session_base.stmt_logical_reads_inc |
| stmt_phys_reads_inc | bigint | null | SqlBLT.session_base.stmt_phys_reads_inc |
| stmt_writes_inc | bigint | null | SqlBLT.session_base.stmt_writes_inc |
| child_wait_ms | bigint | null | SqlBLT.session_base.child_wait_ms |
| child_wait_ms_inc | bigint | null | SqlBLT.session_base.child_wait_ms_inc |
| qplan_att_id | int | null | SqlBLT.session_base.qplan_att_id |
| qplan_time_id | int | null | SqlBLT.session_base.qplan_time_id |
| sqltext_parsed | nvarchar(max) | null | convert(nvarchar(max), decompress(st.sqltext_parsed)) |
| sqltext_unparsed | nvarchar(max) | null | convert(nvarchar(max), decompress(st.sqltext_unparsed)) |
| qplan_parsed | nvarchar(max) | null | convert(nvarchar(max), decompress(qp.qplan_parsed)) |
| qplan_unparsed | nvarchar(max) | null | convert(nvarchar(max), decompress(qp.qplan_unparsed)) |
SqlBLT.aggregate_second, SqlBLT.aggregate_minute, SqlBLT.aggregate_hour, SqlBLT.aggregate_day
Four views with the same columns, one over each aggregate table: the rows of the table with the name of the set and the names of the keys rendered. A key of a dimension the set lacks is -1 (blt '-') and its name null; the object is rendered as database.schema.object from the parts present, the request as session @ start.
| Column | Type | Nullable | Expression |
| agg_time | datetime | not null | the column of the aggregate table |
| set_id | smallint | not null | the column of the aggregate table |
| set_name | varchar(60) | not null | SqlBLT.agg_set.name, through set_id |
| blt | char(1) | not null | the column of the aggregate table |
| database_id | int | not null | the column of the aggregate table |
| database | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through database_id |
| wait_dbname_id | int | not null | the column of the aggregate table |
| wait_schname_id | int | not null | the column of the aggregate table |
| wait_objname_id | int | not null | the column of the aggregate table |
| object | nvarchar(4000) | null | the values of wait_dbname_id, wait_schname_id and wait_objname_id that are present, joined by periods: database.schema.object |
| program_name_id | int | not null | the column of the aggregate table |
| application | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through program_name_id |
| sqltextid | int | not null | the column of the aggregate table |
| query | nvarchar(2048) | null | SqlBLT.ref_sqltext.sqltextleading, through sqltextid |
| host_name_id | int | not null | the column of the aggregate table |
| host | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through host_name_id |
| login_name_id | int | not null | the column of the aggregate table |
| login | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through login_name_id |
| wait_type_id | int | not null | the column of the aggregate table |
| wait_type | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through wait_type_id |
| qplanid | int | not null | the column of the aggregate table |
| resource_type_id | int | not null | the column of the aggregate table |
| resource_type | nvarchar(3072) | null | SqlBLT.ref_value.bpat_value, through resource_type_id |
| request_id | int | not null | the column of the aggregate table |
| request | nvarchar(36) | null | session_id and last_req_start of the row's SqlBLT.ref_request row, written as session @ start; null when the set lacks the request dimension |
| samples | int | not null | the column of the aggregate table |
| polls_present | int | not null | the column of the aggregate table |
| sessions_max | int | not null | the column of the aggregate table |
| session_seconds | bigint | not null | the column of the aggregate table |
| wait_ms | bigint | not null | the column of the aggregate table |
| wait_ms_max | bigint | not null | the column of the aggregate table |
| elapsed_ms_max | bigint | not null | the column of the aggregate table |
| cpu_ms | bigint | not null | the column of the aggregate table |
| logical_reads | bigint | not null | the column of the aggregate table |
| physical_reads | bigint | not null | the column of the aggregate table |
| writes | bigint | not null | the column of the aggregate table |
| child_wait_ms | bigint | not null | the column of the aggregate table |
| child_wait_ms_max | bigint | not null | the column of the aggregate table |
| stmt_wait_ms | bigint | null | the column of the aggregate table |
| stmt_cpu_ms | bigint | null | the column of the aggregate table |
| stmt_logical_reads | bigint | null | the column of the aggregate table |
| stmt_physical_reads | bigint | null | the column of the aggregate table |
| stmt_writes | bigint | null | the column of the aggregate table |
5. Installed rows
5.1 Dictionary attributes: SqlBLT.ref_type
The 33 attributes of SqlBLT.ref_value, each with the column of SqlBLT.session_base that holds the id of its value and the column of the view SqlBLT.sessions that shows the value.
| bpat_id | Attribute and view column | Column of session_base |
| 1 | req_status | req_status_id |
| 2 | session_status | session_status_id |
| 3 | command | command_id |
| 4 | conn_db | conn_db_id |
| 5 | auth_db | auth_db_id |
| 6 | sqltext_objname | sqltext_objname_id |
| 7 | wait_dbname | wait_dbname_id |
| 8 | wait_schname | wait_schname_id |
| 9 | wait_objname | wait_objname_id |
| 10 | wait_object_type | wait_object_type_id |
| 11 | wait_indexname | wait_indexname_id |
| bpat_id | Attribute and view column | Column of session_base |
| 12 | wait_filename | wait_filename_id |
| 13 | wait_filepath | wait_filepath_id |
| 14 | wait_resource | wait_resource_id |
| 15 | last_wait_type | last_wait_type_id |
| 16 | wait_type | wait_type_id |
| 17 | task_wait_type | task_wait_type_id |
| 18 | req_mode | req_mode_id |
| 19 | tran_name | tran_name_id |
| 20 | resource_type | resource_type_id |
| 21 | resource_subtype | resource_subtype_id |
| 22 | resource_description | resource_descr_id |
| bpat_id | Attribute and view column | Column of session_base |
| 23 | host_name | host_name_id |
| 24 | program_name | program_name_id |
| 25 | client_interface_name | client_interface_id |
| 26 | login_name | login_name_id |
| 27 | net_transport | net_transport_id |
| 28 | protocol_type | protocol_type_id |
| 29 | encrypt_option | encrypt_option_id |
| 30 | auth_scheme | auth_scheme_id |
| 31 | client_net_address | client_net_addr_id |
| 32 | local_net_address | local_net_addr_id |
| 33 | error_message | error_message_id |
5.2 Aggregate dimensions: SqlBLT.agg_dimension
| Bit | Dimension | Key columns in the aggregate tables | Source columns in session_base | Rendered by | Description |
| 1 | database | database_id | conn_db_id | ref_value (attribute 4) | The session's database |
| 2 | object | wait_dbname_id, wait_schname_id, wait_objname_id | wait_dbname_id, wait_schname_id, wait_objname_id | ref_value (attribute 7, 8, 9) | The waited resource's database, schema and object |
| 4 | application | program_name_id | program_name_id | ref_value (attribute 24) | program_name of the session |
| 8 | query | sqltextid | sqltextid | ref_sqltext | The text template of the statement |
| 16 | host | host_name_id | host_name_id | ref_value (attribute 23) | host_name of the session |
| 32 | login | login_name_id | login_name_id | ref_value (attribute 26) | login_name of the session |
| 64 | wait type | wait_type_id | wait_type_id | ref_value (attribute 16) | wait_type of the request |
| 128 | plan | qplanid | qplanid | ref_qplan | The plan template of the statement |
| 256 | BLT | blt | BLT | | The row's role at the poll: B blocked, T head blocker, L long running |
| 512 | resource type | resource_type_id | resource_type_id | ref_value (attribute 20) | resource_type of the request's wait |
| 1024 | request | request_id | session_id, last_req_start_time | ref_request | The request: its session and start time (SqlBLT.ref_request) |
5.3 Aggregate sets: SqlBLT.agg_set
The sets as installed. set_id is the sum of the bits of the set's dimensions. Set 1917 is the one the SqlBLT Portal reports read: one row per request, statement, role, wait type and resource type per bucket.
| set_id | Name | Dimensions | Stored per | Enabled |
| 1 | database | database | hour, day | yes |
| 2 | object | object | second, minute, hour, day | yes |
| 3 | database + object | database, object | hour, day | yes |
| 4 | application | application | hour, day | yes |
| 8 | query | query | hour, day | yes |
| 9 | database + query | database, query | hour, day | yes |
| 12 | application + query | application, query | hour, day | yes |
| 16 | host | host | second, minute, hour, day | yes |
| 20 | host + application | application, host | hour, day | yes |
| 32 | login | login | second, minute, hour, day | yes |
| 36 | login + application | application, login | hour, day | yes |
| 64 | wait type | wait type | second, minute, hour, day | yes |
| 66 | object + wait type | object, wait type | second, minute, hour, day | yes |
| 255 | all dimensions | database, object, application, query, host, login, wait type, plan | hour, day | yes |
| 1917 | BLT statement | database, application, query, host, login, wait type, BLT, resource type, request | minute, hour, day | yes |
5.4 Metrics: SqlBLT.metric
The 115 metrics as installed, all enabled. Kind: G a gauge, stored as sampled; D a delta, the growth of a cumulative value over the interval since the previous run; A an average, the growth of a value over the growth of its base. Shown: in the default band of the reports. A file IO metric is collected per database.
| Id | Metric | Category | Kind | Unit | Shown | Source | Read from the source | Description |
| 1 | Wait: SOS_SCHEDULER_YIELD | wait | D | ms | yes | sys.dm_os_wait_stats | wait types like SOS[_]SCHEDULER[_]YIELD | CPU: runnable tasks giving up the scheduler |
| 2 | Wait: ASYNC_NETWORK_IO | wait | D | ms | yes | sys.dm_os_wait_stats | wait types like ASYNC[_]NETWORK[_]IO | The client not consuming results |
| 3 | Wait: LCK (locks) | wait | D | ms | yes | sys.dm_os_wait_stats | wait types like LCK[_]M[_]% | All lock waits |
| 4 | Wait: LATCH | wait | D | ms | yes | sys.dm_os_wait_stats | wait types like LATCH[_]% | Non-buffer latches |
| 5 | Wait: PAGELATCH | wait | D | ms | yes | sys.dm_os_wait_stats | wait types like PAGELATCH[_]% | In-memory page latches (tempdb and hot pages) |
| 6 | Wait: PAGEIOLATCH | wait | D | ms | yes | sys.dm_os_wait_stats | wait types like PAGEIOLATCH[_]% | Pages read from disk |
| 7 | Wait: WRITELOG | wait | D | ms | yes | sys.dm_os_wait_stats | wait types like WRITELOG | Log writes at commit |
| 8 | Wait: CXPACKET | wait | D | ms | yes | sys.dm_os_wait_stats | wait types like CXPACKET | parallelism: producers |
| 9 | Wait: CXCONSUMER | wait | D | ms | yes | sys.dm_os_wait_stats | wait types like CXCONSUMER | parallelism: consumers |
| 10 | Wait: CXSYNC | wait | D | ms | yes | sys.dm_os_wait_stats | wait types like CXSYNC[_]% | Parallelism synchronisation (2019 and later) |
| 11 | Wait: BACKUPIO | wait | D | ms | yes | sys.dm_os_wait_stats | wait types like BACKUPIO | Backup IO |
| 12 | Wait: RESOURCE_SEMAPHORE | wait | D | ms | | sys.dm_os_wait_stats | wait types like RESOURCE[_]SEMAPHORE | Memory grants |
| 13 | Wait: RESOURCE_SEMAPHORE_QUERY_COMPILE | wait | D | ms | | sys.dm_os_wait_stats | wait types like RESOURCE[_]SEMAPHORE[_]QUERY[_]COMPILE | Compile memory |
| 14 | Wait: THREADPOOL | wait | D | ms | | sys.dm_os_wait_stats | wait types like THREADPOOL | Worker thread starvation |
| 15 | Wait: HADR_SYNC_COMMIT | wait | D | ms | | sys.dm_os_wait_stats | wait types like HADR[_]SYNC[_]COMMIT | Availability group synchronous commit |
| 16 | Wait: IO_COMPLETION | wait | D | ms | | sys.dm_os_wait_stats | wait types like IO[_]COMPLETION | Non-data-page IO |
| 17 | Wait: ASYNC_IO_COMPLETION | wait | D | ms | | sys.dm_os_wait_stats | wait types like ASYNC[_]IO[_]COMPLETION | Asynchronous IO (backups, file growth) |
| 18 | Wait: LOGBUFFER | wait | D | ms | | sys.dm_os_wait_stats | wait types like LOGBUFFER | Log buffer space |
| 19 | Wait: PREEMPTIVE | wait | D | ms | | sys.dm_os_wait_stats | wait types like PREEMPTIVE[_]% | Calls outside the scheduler (OS, backup, authentication) |
| 20 | Wait: OLEDB | wait | D | ms | | sys.dm_os_wait_stats | wait types like OLEDB | Linked servers and some DMVs |
| 21 | Wait: MEMORY_ALLOCATION_EXT | wait | D | ms | | sys.dm_os_wait_stats | wait types like MEMORY[_]ALLOCATION[_]EXT | Memory allocation |
| 22 | Wait: RESERVED_MEMORY_ALLOCATION_EXT | wait | D | ms | | sys.dm_os_wait_stats | wait types like RESERVED[_]MEMORY[_]ALLOCATION[_]EXT | Reserved memory allocation |
| 23 | Wait: total | wait | D | ms | yes | sys.dm_os_wait_stats | | Every wait type but the benign ones of SqlBLT.metric_wait_skip |
| 24 | Signal wait: total | wait | D | ms | | sys.dm_os_wait_stats | | Time between the end of a wait and running again: CPU pressure |
| 25 | Wait: other | wait | D | ms | yes | sys.dm_os_wait_stats | | The total less the tracked groups |
| 40 | Batch Requests/sec | counter | D | /s | yes | sys.dm_os_performance_counters | SQL Statistics: Batch Requests/sec | |
| 41 | SQL Compilations/sec | counter | D | /s | | sys.dm_os_performance_counters | SQL Statistics: SQL Compilations/sec | |
| 42 | SQL Re-Compilations/sec | counter | D | /s | | sys.dm_os_performance_counters | SQL Statistics: SQL Re-Compilations/sec | |
| 43 | User Connections | counter | G | count | | sys.dm_os_performance_counters | General Statistics: User Connections | |
| 44 | Processes blocked | counter | G | count | yes | sys.dm_os_performance_counters | General Statistics: Processes blocked | |
| 45 | Logins/sec | counter | D | /s | | sys.dm_os_performance_counters | General Statistics: Logins/sec | |
| 46 | Page life expectancy | counter | G | s | yes | sys.dm_os_performance_counters | Buffer Manager: Page life expectancy | |
| 47 | Page reads/sec | counter | D | /s | | sys.dm_os_performance_counters | Buffer Manager: Page reads/sec | |
| 48 | Page writes/sec | counter | D | /s | | sys.dm_os_performance_counters | Buffer Manager: Page writes/sec | |
| 49 | Lazy writes/sec | counter | D | /s | | sys.dm_os_performance_counters | Buffer Manager: Lazy writes/sec | |
| 50 | Checkpoint pages/sec | counter | D | /s | | sys.dm_os_performance_counters | Buffer Manager: Checkpoint pages/sec | |
| 51 | Page lookups/sec | counter | D | /s | | sys.dm_os_performance_counters | Buffer Manager: Page lookups/sec | |
| 52 | Memory Grants Pending | counter | G | count | yes | sys.dm_os_performance_counters | Memory Manager: Memory Grants Pending | |
| 53 | Memory Grants Outstanding | counter | G | count | | sys.dm_os_performance_counters | Memory Manager: Memory Grants Outstanding | |
| 54 | Total Server Memory (KB) | counter | G | KB | | sys.dm_os_performance_counters | Memory Manager: Total Server Memory (KB) | |
| 55 | Target Server Memory (KB) | counter | G | KB | | sys.dm_os_performance_counters | Memory Manager: Target Server Memory (KB) | |
| 56 | Transactions/sec | counter | D | /s | yes | sys.dm_os_performance_counters | Databases: Transactions/sec (_Total) | |
| 57 | Log Flushes/sec | counter | D | /s | | sys.dm_os_performance_counters | Databases: Log Flushes/sec (_Total) | |
| 58 | Log Flush Wait Time | counter | D | ms | yes | sys.dm_os_performance_counters | Databases: Log Flush Wait Time (_Total) | ms waited for log flushes |
| 59 | Log Bytes Flushed/sec | counter | D | /s | | sys.dm_os_performance_counters | Databases: Log Bytes Flushed/sec (_Total) | bytes |
| 60 | Active Transactions | counter | G | count | | sys.dm_os_performance_counters | Databases: Active Transactions (_Total) | |
| 61 | Lock Requests/sec | counter | D | /s | | sys.dm_os_performance_counters | Locks: Lock Requests/sec (_Total) | |
| 62 | Lock Waits/sec | counter | D | /s | yes | sys.dm_os_performance_counters | Locks: Lock Waits/sec (_Total) | |
| 63 | Lock Wait Time (ms) | counter | D | ms | | sys.dm_os_performance_counters | Locks: Lock Wait Time (ms) (_Total) | |
| 64 | Number of Deadlocks/sec | counter | D | /s | yes | sys.dm_os_performance_counters | Locks: Number of Deadlocks/sec (_Total) | |
| 65 | Lock Timeouts/sec | counter | D | /s | | sys.dm_os_performance_counters | Locks: Lock Timeouts/sec (_Total) | |
| 66 | Latch Waits/sec | counter | D | /s | | sys.dm_os_performance_counters | Latches: Latch Waits/sec | |
| 67 | Average Latch Wait Time (ms) | counter | A | ms | | sys.dm_os_performance_counters | Latches: Average Latch Wait Time (ms), base Average Latch Wait Time Base | |
| 68 | Total Latch Wait Time (ms) | counter | D | ms | | sys.dm_os_performance_counters | Latches: Total Latch Wait Time (ms) | |
| 69 | Full Scans/sec | counter | D | /s | | sys.dm_os_performance_counters | Access Methods: Full Scans/sec | |
| 70 | Page Splits/sec | counter | D | /s | | sys.dm_os_performance_counters | Access Methods: Page Splits/sec | |
| 71 | Index Searches/sec | counter | D | /s | | sys.dm_os_performance_counters | Access Methods: Index Searches/sec | |
| 72 | Forwarded Records/sec | counter | D | /s | | sys.dm_os_performance_counters | Access Methods: Forwarded Records/sec | |
| 73 | Table Lock Escalations/sec | counter | D | /s | | sys.dm_os_performance_counters | Access Methods: Table Lock Escalations/sec | |
| 74 | Plan cache hit ratio | counter | G | % | | sys.dm_os_performance_counters | Plan Cache: Cache Hit Ratio (_Total), base Cache Hit Ratio Base | |
| 75 | Plan cache pages | counter | G | pages | | sys.dm_os_performance_counters | Plan Cache: Cache Pages (_Total) | |
| 76 | Resource pool CPU usage % | counter | G | % | yes | sys.dm_os_performance_counters | Resource Pool Stats: CPU usage % (every instance), base CPU usage % base | Every resource pool: each pool's ratio over its base counter, summed |
| 77 | Active parallel threads | counter | G | count | | sys.dm_os_performance_counters | Workload Group Stats: Active parallel threads (every instance) | Every workload group, summed |
| 78 | Queued requests | counter | G | count | | sys.dm_os_performance_counters | Workload Group Stats: Queued requests (every instance) | Every workload group, summed |
| 79 | Active requests (workload group) | counter | G | count | | sys.dm_os_performance_counters | Workload Group Stats: Active requests (every instance) | Every workload group, summed |
| 80 | Query optimizations/sec | counter | D | /s | | sys.dm_os_performance_counters | Workload Group Stats: Query optimizations/sec (every instance) | Every workload group, summed |
| 81 | Longest Transaction Running Time | counter | G | s | | sys.dm_os_performance_counters | Transactions: Longest Transaction Running Time | |
| 82 | Version Store Size (KB) | counter | G | KB | | sys.dm_os_performance_counters | Transactions: Version Store Size (KB) | |
| 83 | Free Space in tempdb (KB) | counter | G | KB | | sys.dm_os_performance_counters | Transactions: Free Space in tempdb (KB) | |
| 84 | Errors/sec | counter | D | /s | | sys.dm_os_performance_counters | SQL Errors: Errors/sec (_Total) | |
| 85 | Temp Tables Creation Rate | counter | D | /s | | sys.dm_os_performance_counters | General Statistics: Temp Tables Creation Rate | |
| 86 | Workfiles Created/sec | counter | D | /s | | sys.dm_os_performance_counters | Access Methods: Workfiles Created/sec | |
| 87 | Worktables Created/sec | counter | D | /s | | sys.dm_os_performance_counters | Access Methods: Worktables Created/sec | |
| 88 | Readahead pages/sec | counter | D | /s | | sys.dm_os_performance_counters | Buffer Manager: Readahead pages/sec | |
| 89 | Background writer pages/sec | counter | D | /s | | sys.dm_os_performance_counters | Buffer Manager: Background writer pages/sec | |
| 90 | AG log send queue (KB) | counter | G | KB | | sys.dm_os_performance_counters | Database Replica: Log Send Queue (_Total) | Availability groups |
| 91 | AG recovery queue (KB) | counter | G | KB | | sys.dm_os_performance_counters | Database Replica: Recovery Queue (_Total) | Availability groups |
| 92 | AG transaction delay (ms) | counter | G | ms | | sys.dm_os_performance_counters | Database Replica: Transaction Delay (_Total) | Availability groups |
| 93 | AG mirrored write transactions/sec | counter | D | /s | | sys.dm_os_performance_counters | Database Replica: Mirrored Write Transactions/sec (_Total) | Availability groups |
| 100 | SQL process CPU % | cpu | G | % | yes | sys.dm_os_ring_buffers (scheduler monitor) | | The scheduler monitor ring buffer, per minute |
| 101 | Other process CPU % | cpu | G | % | yes | sys.dm_os_ring_buffers (scheduler monitor) | | CPU used by other processes |
| 102 | System idle % | cpu | G | % | | sys.dm_os_ring_buffers (scheduler monitor) | | |
| 103 | Azure average CPU % | cpu | G | % | | sys.dm_db_resource_stats (Azure SQL Database) | | Azure SQL Database: sys.dm_db_resource_stats |
| 104 | Azure average data IO % | cpu | G | % | | sys.dm_db_resource_stats (Azure SQL Database) | | Azure SQL Database |
| 105 | Azure average log write % | cpu | G | % | | sys.dm_db_resource_stats (Azure SQL Database) | | Azure SQL Database |
| 106 | Azure average memory % | cpu | G | % | | sys.dm_db_resource_stats (Azure SQL Database) | | Azure SQL Database |
| 107 | Azure max worker % | cpu | G | % | | sys.dm_db_resource_stats (Azure SQL Database) | | Azure SQL Database |
| 110 | Runnable tasks | scheduler | G | count | yes | sys.dm_os_schedulers | | Tasks waiting for a scheduler: CPU queueing |
| 111 | Pending disk IO | scheduler | G | count | | sys.dm_os_schedulers | | |
| 112 | Workers | scheduler | G | count | | sys.dm_os_schedulers | | |
| 113 | Tasks | scheduler | G | count | | sys.dm_os_schedulers | | |
| 120 | Memory grants waiting | memory | G | count | | sys.dm_exec_query_resource_semaphores | | sys.dm_exec_query_resource_semaphores |
| 121 | Memory grants granted | memory | G | count | | sys.dm_exec_query_resource_semaphores | | |
| 122 | Memory grants available (MB) | memory | G | MB | | sys.dm_exec_query_resource_semaphores | | |
| 123 | SQL memory in use (MB) | memory | G | MB | | sys.dm_os_process_memory | | sys.dm_os_process_memory |
| 124 | SQL memory utilization % | memory | G | % | | sys.dm_os_process_memory | | |
| 130 | User sessions | session | G | count | | sys.dm_exec_sessions | | |
| 131 | Active user requests | session | G | count | yes | sys.dm_exec_requests | | |
| 132 | Blocked requests | session | G | count | yes | sys.dm_exec_requests | | |
| 133 | Suspended requests | session | G | count | | sys.dm_exec_requests | | Requests waiting |
| 140 | tempdb version store (MB) | tempdb | G | MB | | tempdb.sys.dm_db_file_space_usage | | |
| 141 | tempdb user objects (MB) | tempdb | G | MB | | tempdb.sys.dm_db_file_space_usage | | |
| 142 | tempdb internal objects (MB) | tempdb | G | MB | | tempdb.sys.dm_db_file_space_usage | | |
| 143 | tempdb free (MB) | tempdb | G | MB | | tempdb.sys.dm_db_file_space_usage | | |
| 150 | Data file reads | io | D | count | | sys.dm_io_virtual_file_stats | per database | Per database |
| 151 | Data file read MB | io | D | MB | | sys.dm_io_virtual_file_stats | per database | Per database |
| 152 | Data file read stall (ms) | io | D | ms | yes | sys.dm_io_virtual_file_stats | per database | Per database; latency = stall / reads |
| 153 | Data file writes | io | D | count | | sys.dm_io_virtual_file_stats | per database | Per database |
| 154 | Data file write MB | io | D | MB | | sys.dm_io_virtual_file_stats | per database | Per database |
| 155 | Data file write stall (ms) | io | D | ms | | sys.dm_io_virtual_file_stats | per database | Per database; latency = stall / writes |
| 156 | Log file writes | io | D | count | | sys.dm_io_virtual_file_stats | per database | Per database |
| 157 | Log file write MB | io | D | MB | | sys.dm_io_virtual_file_stats | per database | Per database |
| 158 | Log file write stall (ms) | io | D | ms | yes | sys.dm_io_virtual_file_stats | per database | Per database; latency = stall / writes |
| 159 | Log file reads | io | D | count | | sys.dm_io_virtual_file_stats | per database | Per database |
| 160 | Log file read stall (ms) | io | D | ms | | sys.dm_io_virtual_file_stats | per database | Per database |
Wait types left out of the wait totals (SqlBLT.metric_wait_skip), as LIKE patterns: BROKER[_]%, CHECKPOINT[_]QUEUE, CHKPT, CLR[_]%, DBMIRROR%, DIRTY[_]PAGE[_]POLL, DISPATCHER[_]QUEUE[_]SEMAPHORE, FT[_]%, HADR[_]FILESTREAM[_]IOMGR[_]IOCOMPLETION, HADR[_]WORK[_]QUEUE, HADR[_]NOTIFICATION[_]DEQUEUE, HADR[_]TIMER[_]TASK, HADR[_]CLUSAPI[_]CALL, HADR[_]LOGCAPTURE[_]WAIT, KSOURCE[_]WAKEUP, LAZYWRITER[_]SLEEP, LOGMGR[_]QUEUE, ONDEMAND[_]TASK[_]QUEUE, PARALLEL[_]REDO[_]%, PREEMPTIVE[_]XE[_]%, PREEMPTIVE[_]SP[_]SERVER[_]DIAGNOSTICS%, PREEMPTIVE[_]HADR[_]LEASE[_]MECHANISM, PREEMPTIVE[_]OS[_]LIBRARYOPS, PWAIT[_]%, QDS[_]%, REQUEST[_]FOR[_]DEADLOCK[_]SEARCH, RESOURCE[_]QUEUE, SERVER[_]IDLE[_]CHECK, SLEEP[_]%, SNI[_]HTTP[_]ACCEPT, SOS[_]WORK[_]DISPATCHER, SP[_]SERVER[_]DIAGNOSTICS[_]SLEEP, SQLTRACE[_]%, STARTUP[_]DEPENDENCY[_]MANAGER, TRACEWRITE, UCS[_]SESSION[_]REGISTRATION, VDI[_]CLIENT[_]OTHER, WAITFOR, WAIT[_]FOR[_]RESULTS, WAIT[_]XTP[_]%, XE[_]%.
5.5 Settings: SqlBLT.config_setting
The 30 settings with the values installed. To change one, update value in its row; it applies from the next execution of the procedure.
| Procedure | Setting | Value | Range | Description |
| Collect | WaitTimeFilterMS | 10 | 0 to 2,147,483,647 | A blocking hierarchy is kept, with all its sessions, when one of its B rows has waited longer than this; L = user requests older than this |
| Collect | PageIOLatchLookupBudgetMS | 5000 | 0 to 2,147,483,647 | Per run: page lookups of PAGEIOLATCH rows beyond this are skipped (pass p2); 0 = none |
| Collect | MaxSleepingBatchChars | 8000 | 0 to 2,147,483,647 | Text kept for a sleeping T row, whose only text is its whole most recent batch |
| Collect | KeepDatabaseNames | 1 | 0 to 1 | Text and plan templates: 1 = database names stay, 0 = each database name becomes ? (system databases stay) |
| Collect | KeepSchemaNames | 1 | 0 to 1 | Text and plan templates: 1 = schema names stay, 0 = each schema name becomes ? (dbo, sys and INFORMATION_SCHEMA stay) |
| Collect | KeepObjectNames | 1 | 0 to 1 | Text and plan templates: 1 = object names stay, 0 = each table, view, function, procedure and index name becomes ? (sys objects and sp_/xp_ names stay) |
| Collect | ParseSqlText | 1 | 0 to 1 | Statement texts: 1 = each text is de-parameterised and stored as its template, 0 = the SQL parser is not run and each distinct text as captured is a statement of its own |
| Collect | StoreSqlTextSample | 1 | 0 to 1 | Statement texts: 1 = the text as captured is stored (with ParseSqlText = 1: the first original text of each template, as a sample), 0 = it is not stored |
| Collect | QPlanStatementText | 2 | 0 to 2 | Plan template: 0 = remove the statement text, 1 = keep the original statement text, 2 = keep the parsed statement text |
| Collect | QPlanKeepMissingIndexes | 0 | 0 to 1 | Plan template: 0 = MissingIndexes removed, 1 = kept with Impact set to 0 |
| Collect | ParseQPlans | 1 | 0 to 1 | Query plans: 1 = each plan is de-parameterised and stored as its template, 0 = the plan parser is not run and each distinct plan fetched is a plan of its own (with QPlanSkipStorageOfKnownHashes = 1 a plan is not stored when its query_plan_hash already has one) |
| Collect | StoreQPlanSample | 1 | 0 to 1 | Query plans: 1 = the plan as captured is stored (with ParseQPlans = 1: the first original plan of each template, as a sample), 0 = it is not stored |
| Collect | QPlanSkipStorageOfKnownHashes | 1 | 0 to 1 | Plan storage: 1 = a statement whose query_plan_hash already has a template is not parsed or stored again and its rows map to that template, 0 = every distinct plan fetched is stored, keyed by its raw hash |
| Collect | MaxPollGapSeconds | 60 | 1 to 2,147,483,647 | increments: a poll's window is the time since the previous poll, at most this many seconds; a row's increments are its request's and statement's work in the window |
| Collect | CaptureMissingIndexes | 1 | 0 to 1 | Missing index recommendations of SQL Server for the queries of the requests captured: 1 = they are stored (SQL Server 2019 and later: read from sys.dm_db_missing_index_group_stats_query at every poll; before it: read from each plan a poll fetches), 0 = they are not read |
| Collect | QPlanLogAttributes | 1 | 0 to 1 | Attributes of the query plans (warnings of the query optimizer, forced plan, plan guide, compile time and memory): 1 = the plan of every request captured is fetched at every poll and its attributes are logged, 0 = they are not logged and a plan is fetched only to be stored |
| CollectMetrics | MaxIntervalSeconds | 3600 | 1 to 2,147,483,647 | A previous run older than this gives no deltas: the state is rebuilt |
| CollectMetrics | SkipIdleDatabaseIO | 1 | 0 to 1 | 1 = a per-database file IO row with no activity in the interval (a zero delta) is not stored; the aggregates' rates divide by the bucket's seconds, so a missing row counts as zero |
| Aggregate | MaxPollsPerBatch | 30 | 1 to 2,147,483,647 | Polls per batch |
| Aggregate | MaxBatches | 20 | 1 to 2,147,483,647 | Batches per execution |
| Aggregate | StatementFirstSampleNull | 0 | 0 to 1 | Statement sums: 1 = the first sample of a statement adds nothing to stmt_cpu_ms, stmt_logical_reads, stmt_physical_reads and stmt_writes, 0 = it adds its request increments |
| AggregateMetrics | MaxPollsPerBatch | 120 | 1 to 2,147,483,647 | Runs per batch |
| AggregateMetrics | MaxBatches | 50 | 1 to 2,147,483,647 | Batches per execution |
| AggregateMetrics | InMemoryWorkTables | 0 | 0 to 1 | Where a batch is staged: 1 = the memory-optimized tables SqlBLT.metric_agg_polls and SqlBLT.metric_agg_rows, created when missing; 0 = temporary tables |
| MaintainPartitions | DailyCleanupAfterHour | 1 | 0 to 23 | 0 to 23: the first execution at or after this hour of the day does the work; every other execution exits |
| MaintainPartitions | DeleteOrphanedSQLText | 1 | 0 to 1 | 1 = delete the statement texts that no row references any more: those without a reference count in SqlBLT.ref_counts |
| MaintainPartitions | DeleteOrphanedQPlans | 1 | 0 to 1 | 1 = delete the query plans that no row references any more: those without a reference count in SqlBLT.ref_counts |
| MaintainPartitions | MaxRetriesPerDay | 3 | 0 to 100 | After a failed execution: the number of further executions of that day that try again; 0 = none before the next day |
| MaintainPartitions | RebuildRefCountsDayOfMonth | 0 | 0 to 31 | 1 to 31: the execution of that day of every month rebuilds the reference counts from the rows (in a month with fewer days: on its last day); 0 = no monthly rebuild |
| MaintainPartitions | RebuildRefCountsDayOfWeek | 0 | 0 to 7 | 1 = Monday to 7 = Sunday: the execution of that day of every week rebuilds the reference counts from the rows; 0 = no weekly rebuild |
5.6 Partition functions: SqlBLT.config_partition
The nine partition functions with the values installed: RANGE RIGHT on a datetime column, each with a scheme of its name (ps in place of pf) on the default filegroup. With partitions_retained = n the current partition and the n before it keep their rows, and older partitions are truncated; 0 keeps every partition. SqlBLT.MaintainPartitions keeps future_boundaries boundaries ahead of now.
| Function | Scheme | Table | Partitioning column | Boundary period | Future boundaries | Partitions retained |
| pfSqlBLT | psSqlBLT | session_base | now | day | 30 | 14 |
| pfSqlBLTSecond | psSqlBLTSecond | agg_second | agg_time | day | 30 | 14 |
| pfSqlBLTMinute | psSqlBLTMinute | agg_minute | agg_time | day | 30 | 90 |
| pfSqlBLTHour | psSqlBLTHour | agg_hour | agg_time | day | 30 | 183 |
| pfSqlBLTDay | psSqlBLTDay | agg_day | agg_time | day | 30 | 365 |
| pfSqlBLTMetric | psSqlBLTMetric | metric_base | now | day | 30 | 14 |
| pfSqlBLTMetricMinute | psSqlBLTMetricMinute | metric_minute | agg_time | day | 30 | 90 |
| pfSqlBLTMetricHour | psSqlBLTMetricHour | metric_hour | agg_time | day | 30 | 183 |
| pfSqlBLTMetricDay | psSqlBLTMetricDay | metric_day | agg_time | day | 30 | 365 |
5.7 Data types of the size log: SqlBLT.size_type, SqlBLT.size_object
The 11 data types as installed, each with the tables SqlBLT.size_object gives it. The size of a data type is the sum of its tables in SqlBLT.size_table; the rows of one typename sum to its total. The other 38 tables have no data type.
6. Procedures, functions and jobs
6.1 Procedures of the schema SqlBLT
| Procedure | What it does |
| SqlBLT.Collect | Job SqlBLT_Collector, every 10 seconds. Samples the blocked requests (B), the heads of their blocking chains (T) and the long running requests (L); resolves the resources waited for to object names in their databases; fetches statement texts and query plans and has the new ones parsed into templates; stores the missing index recommendations of SQL Server for the queries of the rows (setting CaptureMissingIndexes) in SqlBLT.ref_missing_index and SqlBLT.ref_query_missing_index; computes the increments of each row from SqlBLT.request_state; writes the rows through the view SqlBLT.sessions, then one row to SqlBLT.log_capture and the lookups that failed to SqlBLT.log_capture_error. With the setting QPlanLogAttributes it logs the attributes of the plan of every row in the tables of the query plan attributes. |
| SqlBLT.load_sessions | Called by the trigger of SqlBLT.sessions with the rows of one insert: adds new dictionary values to SqlBLT.ref_value, parses and stores any text or plan given, writes one SqlBLT.session_base row per row, and adds the references of those rows to the reference counts of SqlBLT.ref_counts, in the same transaction. |
| SqlBLT.Aggregate | Job SqlBLT_Aggregate, first step, every 10 minutes. Computes the aggregate tables from SqlBLT.session_base in batches of polls, continuing from the last completed batch in SqlBLT.log_aggregate. A batch takes the next polls of SqlBLT.log_capture, groups their rows by every enabled set at each grain the set is stored at, and adds the result to the four aggregate tables: rows that exist are updated, the rest inserted, and the references of the rows inserted are added to the reference counts of SqlBLT.ref_counts. It catalogues the requests of the batch in SqlBLT.ref_request. A batch is one transaction; a batch that fails is logged, raised and repeated by the next execution. One execution runs at a time. |
| SqlBLT.CollectMetrics | Job SqlBLT_Metrics, every 10 seconds. Samples the instance for the enabled metrics of SqlBLT.metric and writes the rows to SqlBLT.metric_base and one row to SqlBLT.log_metrics; a failure goes to SqlBLT.log_metrics_error and is raised. A cumulative value is stored as its growth since the previous run, whose values are kept in SqlBLT.metric_state. |
| SqlBLT.AggregateMetrics | Job SqlBLT_Aggregate, second step. Computes SqlBLT.metric_minute, SqlBLT.metric_hour and SqlBLT.metric_day from SqlBLT.metric_base in batches of runs, continuing from the last completed batch in SqlBLT.log_metrics_aggregate. A batch is one transaction, staged in temporary tables or, with the setting InMemoryWorkTables = 1, in the memory-optimized tables SqlBLT.metric_agg_polls and SqlBLT.metric_agg_rows. One execution runs at a time. |
| SqlBLT.MaintainPartitions | Job SqlBLT_Aggregate, third step. It does its work once a day, in the first execution at or after the hour of the setting DailyCleanupAfterHour; every other execution exits at once. For each partition function of SqlBLT.config_partition it adds the boundaries of the coming periods, truncates the partitions that are no longer retained, takes the references of their rows off the reference counts of SqlBLT.ref_counts, and merges their boundaries away. The text and plan templates that have no reference count left are then deleted (settings DeleteOrphanedSQLText and DeleteOrphanedQPlans), with the missing index recommendations of those texts. The reference counts are rebuilt from the rows on the days that the settings RebuildRefCountsDayOfMonth and RebuildRefCountsDayOfWeek name. It then logs the size of every table in SqlBLT.size_table and of each partition that holds rows in SqlBLT.size_partition. The work is logged in SqlBLT.log_maintenance and SqlBLT.log_maintenance_partition; after a failure the next executions of that day try again, at most MaxRetriesPerDay times. The attributes of a deleted plan are deleted with it, then the text values that no row names any more. |
| SqlBLT.SetForeignKeys | Executed by a DBA, not by a job. Creates or drops the 137 foreign keys of the SqlBLT tables: all of them, or those of the tables of one section (capture, dictionaries, aggregates, metrics, logging, size), WITH CHECK or WITH NOCHECK. An installation has no foreign key until it is executed, and SqlBLT works the same without them. |
6.2 Functions, table type and trigger of the schema SqlBLT
| Object | What it is |
SqlBLT.fnParseSQLJson_Interp SqlBLT.fnParseSQLJson_InMem | The SQL parser, a scalar function: parses one T-SQL batch in a single scan and returns its de-parameterised text, in which each literal is replaced by ?, or a JSON text with the statements of the batch and the objects each statement references. Options keep or mask database, schema and object names. _InMem is the same definition natively compiled, created when the database supports In-Memory OLTP; the procedures call it when it exists and _Interp otherwise. |
SqlBLT.fnParseQPlan_Interp SqlBLT.fnParseQPlan_InMem | The plan parser, a scalar function: returns the template of a showplan XML text, with the compile, statistics, memory and hardware detail removed, the estimates set to 0, the literals and generated names masked and the shape and operators kept. _InMem is the same definition natively compiled. |
| SqlBLT.fnParseSQL | A table-valued function: the statements of a T-SQL batch and the objects each statement references, one row per statement and one per referenced object. Created when the compatibility level of the database is 130 or higher. The collector does not call it. |
| SqlBLT.sessions_rows | Table type: the rows of one insert into SqlBLT.sessions, as the trigger hands them to SqlBLT.load_sessions. |
| SqlBLT.tr_sessions | INSTEAD OF INSERT trigger on the view SqlBLT.sessions: hands the rows to SqlBLT.load_sessions. |
6.3 Report schema SqlBLTPortal
The procedures that the SqlBLT Portal calls. They read the SqlBLT tables by ownership chaining and change nothing. The database role SqlBLT_Reader holds EXECUTE on the schema and nothing else, which is all that a user of the Portal needs.
| Object | What it returns |
| SqlBLTPortal.portal_version | The version of the report procedures, the SqlBLT version installed, and whether the database holds the aggregate set 1917. |
| SqlBLTPortal.portal_capture | One row: the polls held, the SqlBLT version, the range that the aggregate set 1917 covers at each grain, and the requests catalogued. |
| SqlBLTPortal.portal_names | The values of the filter dimensions seen in a range: role, database, application, host, login, wait type and resource type. |
| SqlBLTPortal.portal_report | The TopX report: the rows of the aggregate set 1917 at a grain within a range, filtered and grouped by the dimensions split on, the top rows first, with the missing index recommendations of SQL Server for the statements of those rows and the attributes of their query plans. |
| SqlBLTPortal.portal_hierarchies | The Timeline report: the top blockers of a range by their child waits, each with the blocking hierarchies beneath it as lanes over time, from SqlBLT.session_base, with the missing index recommendations of SQL Server for the requests of the lanes and the attributes of their query plans. |
| SqlBLTPortal.portal_qplan_warnings | The warnings of the query optimizer found in a range, each with the column, conversion or index it names, and the statements of each. |
| SqlBLTPortal.portal_statement | One statement in a range: its text and totals, and the requests that ran it. |
| SqlBLTPortal.portal_request | One request: its catalogue row, its roles in the aggregates and its samples while SqlBLT.session_base holds them. |
| SqlBLTPortal.portal_text | The text of one statement: the parsed template when held, else the original text. |
| SqlBLTPortal.portal_plan | One query plan: the raw plan when held, else the parsed template. |
| SqlBLTPortal.portal_metrics | The metrics band of the reports: the metrics of SqlBLT.metric, the scopes of the per-database metrics, and the series of the chosen metrics at a grain within a range. |
SqlBLTPortal.portal_ids SqlBLTPortal.portal_metric_keys SqlBLTPortal.portal_text_filters | Table types of the procedures' list parameters: a list of ids, a list of metric and scope ids, and the filters on the text of a statement. |
6.4 SQL Server Agent jobs
Created by the install script, owned by sa; none on Azure SQL Database, which has no SQL Server Agent. The steps pass no parameters.
| Job | Schedule | Step | Command |
| SqlBLT_Collector | every 10 seconds | CollectSqlBLT | exec SqlBLT.Collect; |
| SqlBLT_Metrics | every 10 seconds | CollectMetricsSqlBLT | exec SqlBLT.CollectMetrics; |
| SqlBLT_Aggregate | every 10 minutes | AggregateSqlBLT | exec SqlBLT.Aggregate; |
| | AggregateMetricsSqlBLT | exec SqlBLT.AggregateMetrics; |
| | MaintainPartitionsSqlBLT | exec SqlBLT.MaintainPartitions; |