Before we can start creating our memory-optimized objects, we need to create a database with a FILEGROUP designed for memory-optimized objects. This can be achieved as follows:
CREATE DATABASE InMemoryTest ON PRIMARY(NAME = [InMemoryTest_disk], FILENAME = 'C:tempInMemoryTest_disk.mdf', size=100MB), FILEGROUP [InMemoryTest_inmem] CONTAINS MEMORY_OPTIMIZED_DATA (NAME = [InMemoryTest_inmem], FILENAME = 'C:tempInMemoryTest_inmem') LOG ON (name = [InMemoryTest_log], Filename='c:tempInMemoryTest_log.ldf', size=100MB) COLLATE Latin1_General_100_BIN2;
The first main thing to note is that we have a separate FILEGROUP dedicated to the memory-optimized objects, with the keyword CONTAINS MEMORY_OPTIMIZED_DATA. This FILEGROUP is ...