SQL Server 2017 sys.dm_db_xtp_checkpoint_internals

This new DMV is not currently documented, but below shows it in action:

--create test database
CREATE DATABASE d
GO
-- allow in-memory on database
ALTER DATABASE d ADD FILEGROUP [fg] CONTAINS MEMORY_OPTIMIZED_DATA;
ALTER DATABASE d ADD FILE (NAME = f, FILENAME = N'C:\temp\') TO FILEGROUP [fg];
USE d;
--create test table
CREATE TABLE t (c1 int INDEX i1 NONCLUSTERED, c2 varchar(10)) 
WITH (MEMORY_OPTIMIZED = ON, DURABILITY = SCHEMA_ONLY); 
--view sys.dm_db_xtp_checkpoint_internals
SELECT * FROM sys.dm_db_xtp_checkpoint_internals;
--create a checkpoint
CHECKPOINT;
--view sys.dm_db_xtp_checkpoint_internals
SELECT * FROM sys.dm_db_xtp_checkpoint_internals;
--create a checkpoint
CHECKPOINT;
--view sys.dm_db_xtp_checkpoint_internals
SELECT * FROM sys.dm_db_xtp_checkpoint_internals;

image1

sys.dm_db_column_store_row_group_physical_stats

The DMV called sys.dm_db_column_store_row_group_physical_stats helps with reviewing column store indexes and especially deciding when the deleted rows (fragmentation) value is high.
 
Performance issues with this DMV were resolved in SQL Server 2016 SP1 CU1.
 
Columns returned are:
image1
Below is sample query to include the table and index name:

SELECT 
'[' + OBJECT_SCHEMA_NAME(a.[object_id]) + '].[' + OBJECT_NAME(a.[object_id]) + ']' AS table_name
,b.[name] AS column_store_index_name
,a.* 
FROM sys.dm_db_column_store_row_group_physical_stats a, sys.indexes b
WHERE 1=1
AND a.[object_id] = b.[object_id]
AND a.index_id = b.index_id;

image2
Further info can be found here.

SQL Server 2017 sys.query_store_wait_stats

sys.query_store_wait_stats is new to SQL Server 2017 and requires the query store as the name indicates.
 
Below shows a simple extract of the contained information.

SELECT 
 d.[text]
,CAST(b.query_plan AS xml) AS query_plan
,a.*
FROM sys.query_store_wait_stats a
INNER JOIN sys.query_store_plan b ON a.plan_id = b.plan_id
INNER JOIN sys.dm_exec_query_stats c ON b.query_plan_hash = c.query_plan_hash
CROSS APPLY sys.dm_exec_sql_text(c.[sql_handle]) d

image1

SQL Server 2017 sys.fn_full_dblog

There is a new DMF in SQL Server 2017 called sys.fn_full_dblog which is a more powerful alternative for the current sys.fn_dblog.
 
As shown below, sys.fn_full_dblog has several more parameters, but the returned columns are still the same.

--current sys.fn_dblog
SELECT TOP 10 * FROM sys.fn_dblog(null,null)
--SQL server 2017
SELECT TOP 10 * FROM sys.fn_full_dblog(null,null,DB_ID(),null,null,null,null,null)

image
The parameters available for sys.fn_dblog are:
image2
The parameters available for the new sys.fn_full_dblog are:
image3
With these extra parameters you can now target multiple databases etc.

SELECT a.[name] AS [database_name], COUNT(1) AS records
FROM sys.databases a
CROSS APPLY sys.fn_full_dblog(null,null,a.database_id,null,null,null,null,null) b
GROUP BY a.[name];

image4
NB: Both sys.fn_dblog and sys.fn_full_dblog are currently undocumented.

SQL Server 2017 sys.dm_db_log_info

There is a new DMF called sys.dm_db_log_info which takes a single int parameter called @DatabaseId.
 
Below shows the output compared to the older DBCC LOGINFO and it makes vlf info a lot easier to review.

--old way
DBCC LOGINFO;

--SQL Server 2017
SELECT * FROM sys.dm_db_log_info(DB_ID(DB_NAME()));

image1
Below is an example of viewing multiple database vlf counts.

SELECT a.[name] AS [database_name], COUNT(b.database_id) AS vlfs 
FROM sys.databases a
CROSS APPLY sys.dm_db_log_info(a.database_id) b
GROUP BY a.[name];

image
Futher info can be found here.

Y and N vs 1 and 0

I suspect the Microsoft SQL development and change teams must be overrun at the moment.
 
That’s the only thing I could think of when I saw this in sys.dm_server_services:
image1
Since when did Microsoft start using uppercase Y and N instead of the usual 1 and 0?
 
It’s not a documentation error. How did that get through peer review and change control?
image2

New Azure SQL databases will be encrypted at rest by default

As mentioned here.
 
I suspect this raises an interesting question, who is responsible for the TDE keys, especially when it comes to long term-term backup retention as Microsoft automatically rotates these certificates at least every 90 days and I suspect the underlying server will change at some stage.
 
According to this it shouldn’t be an issue.
’10. Q: I have TDE enabled for my database. Can I use TDE with the vault?

A. Yes, TDE is supported. You can restore the database from the vault even if the original database no longer exists.