1

I have a memory optimised table in SQL Server 2016, with file durability enabled. The table is only 100MB. SQL Server is constantly creating new files on disk, which start off at a few hundred MB, but then grow constantly until the drive runs out of space then they clear down and the process starts again. The files are growing at about 900MB an hour. Running the SQL below shows that all the space is in Precreated Data - so it's not even actually storing large amounts of data, just allocating space to use later.

SELECT state_desc, file_type_desc, COUNT(*) AS [count], 
  SUM(file_size_in_bytes) / 1024 / 1024 AS [on-disk size MB]   
FROM sys.dm_db_xtp_checkpoint_files  
GROUP BY state, state_desc, file_type, file_type_desc  
ORDER BY state, file_type

Results of query

File growth on the file group is set to unlimited, so I'm assuming I can set a value on this and stop it growing, but I can't find anything to say why it's allocating so much space in the first place. The data in the table does change very rapidly (a lot of inserts and deletes as the data is constantly processed, but it the data that isn't Precreated never gets over 4GB.

Is there a setting in SQL Server that controls this file precreation? Is it safe to set a limit on the autogrowth for the file group?

1

Question title says SQL 2014, but question text says SQL 2016. This issue is not necessarily a bug in either version.

Assuming db is in full recovery, in order for file merge to occur, transaction log backups and checkpoints must occur. If running simple, checkpoint alone will take care of file merge and clearing the log. Please see this blog post:

https://blogs.msdn.microsoft.com/psssql/2017/03/06/why-am-i-getting-so-many-checkpoint-files-when-i-have-in-memory-oltp-enabled/

But @Slowry is also correct, in that you must be fully patched.

There is no knob you can turn to affect file precreation, although the required storage footprint is less in SQL 2016. There is no way to control the size of checkpoint file pairs, containers, or the memory optimized file group (in any version of SQL Server that currently supports In-Memory OLTP).

  • Log backups are being taken regularly, and full backups nightly, but the files still continue to grow to the point of filling the drive over the space of a week, so in my case it definitely was the bug I linked to (I finally found the answer to my own question, after searching for hours, then posting the question!). I'll leave this up though, as it was hard to find the bug post and other people may be having the same issue. – SLowry Nov 16 '17 at 17:10
0

It's a bug in SQL Server 2016 that's fixed in SP1 CU2 / CU4 with no SP. https://support.microsoft.com/en-us/help/3206584/fix-checkpoint-files-grow-excessively-when-you-insert-data-into-memory

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.