Heim >Datenbank >MySQL-Tutorial >试试SQLSERVER2014的内存优化表
试试 SQLSERVER2014的 内存 优化 表 SQL Server 2014中的 内存 引擎(代号为Hekaton)将OLTP提升到了新的高度。 现在,存储引擎已整合进当前的数据库管理系统,而使用先进 内存 技术来支持大规模OLTP工作负载。 就算如此,要利用此新功能,数据库必须包含 内存
SQL Server 2014中的内存引擎(代号为Hekaton)将OLTP提升到了新的高度。
现在,存储引擎已整合进当前的数据库管理系统,而使用先进内存技术来支持大规模OLTP工作负载。
就算如此,要利用此新功能,数据库必须包含“内存优化”文件组和表
即所配置的文件组和表使用Hekaton技术。
幸运的是,SQL Server 2014使这一过程变得非常简单直接。
要说明其工作原理,我们来创建一个名为TestHekaton的数据库,然后添加一个内存优化文件组到此数据库
测试环境:Microsoft Azure 大陆版 虚拟机
4核 ,7G内存,Windows2012R2
SQLSERVER2014企业版
实验
第一个实验:内存表的简单使用
步骤1:创建数据库和MEMORY_OPTIMIZED_DATA文件组
<span>USE</span><span> master; </span><span>GO</span> <span>CREATE</span> <span>DATABASE</span><span> TestHekaton; </span><span>GO</span> <span>ALTER</span> <span>DATABASE</span><span> TestHekaton </span><span>ADD</span> FILEGROUP HekatonFG <span>CONTAINS</span><span> MEMORY_OPTIMIZED_DATA; </span><span>GO</span>
注意ALTER DATABASE语句中的ADD FILEGROUP 语句包含文件组的名称(HekatonFG)和关键字CONTAINS MEMORY_OPTIMIZED_DATA
它会指导SQL Server去创建支持内存OLTP引擎所必需的文件组类型。
注意:每个数据库只能有一个MEMORY_OPTIMIZED_DATA文件组!!
要确认此文件组已经创建,可以访问SSMS中数据库属性的Filegroups 界面,如下图所示。
步骤2:
添加一个数据文件到文件组,可以通过ALTER DATABASE语句来实现。
添加一个新数据文件到HekatonFG文件组:
<span>ALTER</span> <span>DATABASE</span><span> TestHekaton </span><span>ADD</span> <span>FILE</span><span> ( NAME </span><span>=</span> <span>'</span><span>HekatonFile</span><span>'</span><span>, FILENAME </span><span>=</span><span>'</span><span>C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\HekatonFile</span><span>'</span><span> ) </span><span>TO</span> FILEGROUP <span>[</span><span>HekatonFG</span><span>]</span><span>; </span><span>GO</span>
注意:在ADD FILE 语句中,我们只为文件路径和文件名提供了一个友好的名称。
并且,在TO FILEGROUP 语句中,为新文件组指定名称。
然后可以去往数据库属性的 Files 界面来查看刚刚添加的文件,如图所示。
步骤3:
在为数据库设置了必需的文件组和文件之后,就可以创建自己的内存优化表了。
当在定义表的时候,会指定其“持久性”。
一个内存优化表可以是持久的或非持久的。
(1)对于一个持久表是将数据存储在内存中,而且也保存在内存优化文件组中。
(2)对于一个非持久表,数据是仅存储在内存中的,所以,如果系统崩溃或重启,数据就会丢失。
在SQL Server 2014中默认用的是持久表,接下来我们来深入了解一下。
当定义一个持久内存优化表的时候,你还必须定义一个基于非聚集哈希索引的主键。
在一个哈希索引中,数据是通过一个内存散列表进行访问的,而非固定大小页。
哈希索引是在内存优化表中唯一支持的索引类型。
除了在表定义中定义主键外,还必须将表配置为内存优化的,如下CREATE TABLE 语句所示:
<span>USE</span><span> TestHekaton; </span><span>GO</span> <span>CREATE</span> <span>TABLE</span><span> Reseller ( </span><span>[</span><span>ResellerID</span><span>]</span> <span>INT</span> <span>NOT</span> <span>NULL</span> <span>PRIMARY</span> <span>KEY</span> <span>NONCLUSTERED</span> HASH <span>WITH</span> (BUCKET_COUNT <span>=</span> <span>1024</span><span>), </span><span>[</span><span>ResellerName</span><span>]</span> <span>NVARCHAR</span>(<span>50</span>) <span>NOT</span> <span>NULL</span><span> , </span><span>[</span><span>ResellerType</span><span>]</span> <span>NVARCHAR</span>(<span>20</span>) <span>NOT</span> <span>NULL</span><span> ) </span><span>WITH</span> (MEMORY_OPTIMIZED <span>=</span> <span>ON</span>, DURABILITY <span>=</span><span> SCHEMA_AND_DATA); </span><span>INSERT</span> <span>INTO</span><span> Reseller </span><span>VALUES</span> ( <span>1</span>, <span>'</span><span>A Bike Store</span><span>'</span>, <span>'</span><span>Value Added Reseller</span><span>'</span> );
ResellerID 字段定义包含了定义为非聚集哈希的主键。
注意,必须包含一个WITH 语句来指定BUCKET_COUNT 的设置,它表明了在哈希索引中应该创建的bucket数量。
(每个bucket是一个槽,可以用来存放一组键值对。)
微软建议bucket的数量应是一到两倍于你所期望的表所要包含的唯一索引键的数量。
此表定义以第二个WITH 语句结束。
这里你指定MEMORY_OPTIMIZED 选项为ON 以及DURABILITY 选项为SCHEMA_AND_DATA,此选项是针对持久表的。
接着在表中插入一条记录,这样就可以进行测试了。
数据已经插入到表中
这就是创建一个内存优化表的全部步骤,其他的一切都会发生在幕后。
但是,要记住,SQL Server 2014对这些表有着很多限制。例如,它们不支持外键或约束检查(感觉类似于MYSQL的memory存储引擎),
它们也不支持IDENTITY 字段或DML触发器。最为重要的是,内存耗尽会导致写活动停止。
步骤4:
另一方面,内存优化表支持本地编译存储过程,只要那些存储过程只引用内存优化表。
在这种情况下,存储过程可以转化为本地代码,这样会执行更快且要比典型存储过程需要更少的内存。
除了只引用内存优化表,一个本地编译存储过程必须是模式绑定的并运行在一个特定执行内容内。
另外,每个本地编译存储过程必须完全由一个原子块组成。
下面的CREATE PROCEDURE 语句定义了一个本地编译存储过程,它从前例中所创建的Reseller表中检索数据
<span>CREATE</span> <span>PROCEDURE</span> GetResellerType ( <span>@id</span> <span>INT</span><span> ) </span><span>WITH</span><span> NATIVE_COMPILATION, SCHEMABINDING, </span><span>EXECUTE</span> <span>AS</span><span> OWNER </span><span>AS</span> <span>BEGIN</span><span> ATOMIC </span><span>WITH</span>(<span>TRANSACTION</span> <span>ISOLATION</span> <span>LEVEL</span> <span>=</span> SNAPSHOT, LANGUAGE <span>=</span> <span>'</span><span>us_english</span><span>'</span><span>) </span><span>SELECT</span><span> ResellerName , ResellerType </span><span>FROM</span><span> dbo.Reseller </span><span>WHERE</span> ResellerID <span>=</span> <span>@id</span> <span>END</span><span>; </span><span>GO</span>
在定义了参数之后,包含一个WITH 语句来指定NATIVE_COMPILATION 选项。
注意:此语句还包含SCHEMABINDING 选项和EXECUTE AS 选项,以及指定了OWNER 作为执行环境。
而WITH 语句负责实现本地编译存储过程的三大需求。
要解决原子块需求,可以在BEGIN 关键字后指定ATOMIC ,之后是另一个包含有事务隔离级别和语言的WITH 语句。
对于访问内存优化表的事务,可以使用SNAPSHOT,REPEATABLEREAD 或SERIALIZABLE 作为隔离级。
而且,对于此语言必须使用一个可用的语言或语言别名。
这是在定义存储过程时所需要包含的全部内容。一旦创建,就可以通过执行EXECUTE 语句来对其加以测试,如下例中所示:
<span>EXEC</span> GetResellerType <span>1</span>;
此语句会返回经销商的姓名和类型,在本例中分别是ABike Store和Value Added Reseller。
第一个实验:内存表的数据查询速度比较
聚集索引表和内存优化表的比较
建表语句
<span>USE</span><span> TestHekaton; </span><span>GO</span> <span>--</span><span><strong>内存</strong><strong>优化</strong>表</span> <span>CREATE</span> <span>TABLE</span><span> testmemory1 ( </span><span>[</span><span>ID</span><span>]</span> <span>FLOAT</span> <span>NOT</span> <span>NULL</span> <span>PRIMARY</span> <span>KEY</span> <span>NONCLUSTERED</span> HASH <span>WITH</span> (BUCKET_COUNT <span>=</span> <span>1024</span><span>), </span><span>[</span><span>Name</span><span>]</span> <span>NVARCHAR</span>(<span>50</span>) <span>NOT</span> <span>NULL</span><span> ) </span><span>WITH</span> (MEMORY_OPTIMIZED <span>=</span> <span>ON</span>, DURABILITY <span>=</span> SCHEMA_AND_DATA);
<span>USE</span><span> TestHekaton; </span><span>GO</span> <span>--</span><span>聚集索引表</span> <span>CREATE</span> <span>TABLE</span><span> testmemory2 ( </span><span>[</span><span>ID</span><span>]</span> <span>FLOAT</span> <span>NOT</span> <span>NULL</span> <span>PRIMARY</span> <span>KEY</span><span>, </span><span>[</span><span>Name</span><span>]</span> <span>NVARCHAR</span>(<span>50</span>) <span>NOT</span> <span>NULL</span><span> )</span>
---------------------------------------------------------------
插入性能比较
内存优化表
<span>SET</span> <span>STATISTICS</span> IO <span>ON</span> <span>SET</span> <span>STATISTICS</span> TIME <span>ON</span> <span>INSERT</span> <span>into</span> testmemory1(<span>[</span><span>id</span><span>]</span>,<span>[</span><span>name</span><span>]</span>) <span>SELECT</span> <span>[</span><span>id</span><span>]</span> ,<span>[</span><span>name</span><span>]</span> <span>from</span><span> sysobjects </span><span>SET</span> <span>STATISTICS</span> IO <span>OFF</span> <span>SET</span> <span>STATISTICS</span> TIME <span>OFF</span>
<span>Table</span> <span>'</span><span>sysschobjs</span><span>'</span>. Scan <span>count</span> <span>1</span>, logical reads <span>33</span>, physical reads <span>0</span>, <span>read</span><span>-</span>ahead reads <span>0</span>, lob logical reads <span>0</span>, lob physical reads <span>0</span>, lob <span>read</span><span>-</span>ahead reads <span>0</span><span>. SQL Server Execution Times: CPU time </span><span>=</span> <span>0</span> ms, elapsed time <span>=</span> <span>20</span><span> ms. (</span><span>90</span><span> row(s) affected) SQL Server Execution Times: CPU time </span><span>=</span> <span>0</span> ms, elapsed time <span>=</span> <span>0</span><span> ms. SQL Server Execution Times: CPU time </span><span>=</span> <span>0</span> ms, elapsed time <span>=</span> <span>0</span> ms.
聚集索引表
<span>SET</span> <span>STATISTICS</span> IO <span>ON</span> <span>SET</span> <span>STATISTICS</span> TIME <span>ON</span> <span>INSERT</span> <span>into</span> testmemory2(<span>[</span><span>id</span><span>]</span>,<span>[</span><span>name</span><span>]</span>) <span>SELECT</span> <span>[</span><span>id</span><span>]</span> ,<span>[</span><span>name</span><span>]</span> <span>from</span><span> sysobjects </span><span>SET</span> <span>STATISTICS</span> IO <span>OFF</span> <span>SET</span> <span>STATISTICS</span> TIME <span>OFF</span>
<span>Table</span> <span>'</span><span>testmemory2</span><span>'</span>. Scan <span>count</span> <span>0</span>, logical reads <span>183</span>, physical reads <span>0</span>, <span>read</span><span>-</span>ahead reads <span>0</span>, lob logical reads <span>0</span>, lob physical reads <span>0</span>, lob <span>read</span><span>-</span>ahead reads <span>0</span><span>. </span><span>Table</span> <span>'</span><span>sysschobjs</span><span>'</span>. Scan <span>count</span> <span>1</span>, logical reads <span>33</span>, physical reads <span>0</span>, <span>read</span><span>-</span>ahead reads <span>0</span>, lob logical reads <span>0</span>, lob physical reads <span>0</span>, lob <span>read</span><span>-</span>ahead reads <span>0</span><span>. SQL Server Execution Times: CPU time </span><span>=</span> <span>0</span> ms, elapsed time <span>=</span> <span>10</span><span> ms. (</span><span>90</span><span> row(s) affected) SQL Server Execution Times: CPU time </span><span>=</span> <span>0</span> ms, elapsed time <span>=</span> <span>0</span> ms.
-------------------------------------------------------------------------------
查询性能比较
内存优化表
<span>SET</span> <span>STATISTICS</span> IO <span>ON</span> <span>SET</span> <span>STATISTICS</span> TIME <span>ON</span> <span>SELECT</span> <span>*</span> <span>FROM</span> testmemory1 <span>ORDER</span> <span>BY</span> <span>[</span><span>ID</span><span>]</span> <span>DESC</span> <span>SET</span> <span>STATISTICS</span> IO <span>ON</span> <span>SET</span> <span>STATISTICS</span> TIME <span>ON</span>
SQL Server parse <span>and</span><span> compile time: CPU time </span><span>=</span> <span>0</span> ms, elapsed time <span>=</span> <span>1</span><span> ms. SQL Server Execution Times: CPU time </span><span>=</span> <span>0</span> ms, elapsed time <span>=</span> <span>0</span><span> ms. SQL Server Execution Times: CPU time </span><span>=</span> <span>0</span> ms, elapsed time <span>=</span> <span>0</span><span> ms. (</span><span>90</span><span> row(s) affected) SQL Server Execution Times: CPU time </span><span>=</span> <span>0</span> ms, elapsed time <span>=</span> <span>0</span><span> ms. SQL Server Execution Times: CPU time </span><span>=</span> <span>0</span> ms, elapsed time <span>=</span> <span>0</span> ms.
聚集索引表
<span>SET</span> <span>STATISTICS</span> IO <span>ON</span> <span>SET</span> <span>STATISTICS</span> TIME <span>ON</span> <span>SELECT</span> <span>*</span> <span>FROM</span> testmemory2 <span>ORDER</span> <span>BY</span> <span>[</span><span>ID</span><span>]</span> <span>DESC</span> <span>SET</span> <span>STATISTICS</span> IO <span>ON</span> <span>SET</span> <span>STATISTICS</span> TIME <span>ON</span>
(<span>91</span><span> row(s) affected) </span><span>Table</span> <span>'</span><span>testmemory2</span><span>'</span>. Scan <span>count</span> <span>1</span>, logical reads <span>2</span>, physical reads <span>0</span>, <span>read</span><span>-</span>ahead reads <span>0</span>, lob logical reads <span>0</span>, lob physical reads <span>0</span>, lob <span>read</span><span>-</span>ahead reads <span>0</span><span>. SQL Server Execution Times: CPU time </span><span>=</span> <span>0</span> ms, elapsed time <span>=</span> <span>0</span><span> ms. SQL Server Execution Times: CPU time </span><span>=</span> <span>0</span> ms, elapsed time <span>=</span> <span>0</span> ms.
可以看到内存优化表读写数据(insert 、select)的时候都看不到IO读写
补充测试:
我们先删除刚才插入的数据,内存优化表是不支持truncate table的,只能用delete from 表
只能够delete
插入测试
内存优化表
聚集索引表
-------------------------------------------------------------------------------------------------
查询测试
内存优化表
聚集索引表
我们看一下事务日志
<span>CHECKPOINT</span> <span>GO</span> <span>SELECT</span><span> Context , Operation, AllocUnitName </span><span>FROM</span> sys.fn_dblog(<span>NULL</span>, <span>NULL</span>)
Context | Operation | AllocUnitName |
LCX_NULL | LOP_HK | NULL |
LCX_NULL | LOP_HK_CHAINED | NULL |
LCX_NULL | LOP_HK | NULL |
LCX_NULL | LOP_HK_CHAINED | NULL |
LCX_NULL | LOP_HK_CHECKPOINT | NULL |
LCX_NULL | LOP_HK | NULL |
LCX_NULL | LOP_BEGIN_XACT | NULL |
LCX_NULL | LOP_FS_DOWNLEVEL_OP | NULL |
LCX_NULL | LOP_BEGIN_XACT | NULL |
LCX_CLUSTERED | LOP_INSERT_ROWS | sys.filestream_tombstone_2073058421.FSTSClusIdx |
LCX_INDEX_LEAF | LOP_INSERT_ROWS | sys.filestream_tombstone_2073058421.FSTSNCIdx |
LCX_NULL | LOP_COMMIT_XACT | NULL |
LCX_MARK_AS_GHOST | LOP_DELETE_ROWS | sys.filestream_tombstone_2073058421.FSTSClusIdx |
LCX_MARK_AS_GHOST | LOP_DELETE_ROWS | sys.filestream_tombstone_2073058421.FSTSNCIdx |
LCX_NULL | LOP_HK | NULL |
LCX_NULL | LOP_FS_DOWNLEVEL_OP | NULL |
LCX_HEAP | LOP_INSERT_ROWS | sys.xtp_storage |
LCX_INDEX_LEAF | LOP_INSERT_ROWS | sys.xtp_storage.UQ__xtp_stor__3213E83EA8737D06 |
LCX_CLUSTERED | LOP_EXPUNGE_ROWS | sys.filestream_tombstone_2073058421.FSTSClusIdx |
LCX_CLUSTERED | LOP_EXPUNGE_ROWS | sys.filestream_tombstone_2073058421.FSTSClusIdx |
LCX_PFS | LOP_SET_BITS | sys.filestream_tombstone_2073058421.FSTSClusIdx |
LCX_INDEX_LEAF | LOP_EXPUNGE_ROWS | sys.filestream_tombstone_2073058421.FSTSNCIdx |
LCX_INDEX_LEAF | LOP_EXPUNGE_ROWS | sys.filestream_tombstone_2073058421.FSTSNCIdx |
LCX_NULL | LOP_COMMIT_XACT | NULL |
LCX_NULL | LOP_BEGIN_XACT | NULL |
LCX_NULL | LOP_FS_DOWNLEVEL_OP | NULL |
LCX_NULL | LOP_BEGIN_XACT | NULL |
LCX_CLUSTERED | LOP_INSERT_ROWS | sys.filestream_tombstone_2073058421.FSTSClusIdx |
LCX_INDEX_LEAF | LOP_INSERT_ROWS | sys.filestream_tombstone_2073058421.FSTSNCIdx |
LCX_NULL | LOP_COMMIT_XACT | NULL |
LCX_MARK_AS_GHOST | LOP_DELETE_ROWS | sys.filestream_tombstone_2073058421.FSTSClusIdx |
LCX_PFS | LOP_SET_BITS | sys.filestream_tombstone_2073058421.FSTSClusIdx |
LCX_MARK_AS_GHOST | LOP_DELETE_ROWS | sys.filestream_tombstone_2073058421.FSTSNCIdx |
LCX_NULL | LOP_FS_DOWNLEVEL_OP | NULL |
LCX_HEAP | LOP_INSERT_ROWS | sys.xtp_storage |
LCX_INDEX_LEAF | LOP_INSERT_ROWS | sys.xtp_storage.UQ__xtp_stor__3213E83EA8737D06 |
LCX_NULL | LOP_COMMIT_XACT | NULL |
LCX_NULL | LOP_HK | NULL |
LCX_CLUSTERED | LOP_EXPUNGE_ROWS | sys.filestream_tombstone_2073058421.FSTSClusIdx |
LCX_INDEX_LEAF | LOP_EXPUNGE_ROWS | sys.filestream_tombstone_2073058421.FSTSNCIdx |
LCX_PFS | LOP_SET_BITS | sys.filestream_tombstone_2073058421.FSTSClusIdx |
LCX_PFS | LOP_SET_BITS | sys.filestream_tombstone_2073058421.FSTSNCIdx |
LCX_CLUSTERED | LOP_COUNT_DELTA | sys.sysallocunits.clust |
LCX_CLUSTERED | LOP_COUNT_DELTA | sys.sysrowsets.clust |
LCX_CLUSTERED | LOP_COUNT_DELTA | sys.sysrscols.clst |
LCX_CLUSTERED | LOP_COUNT_DELTA | sys.sysrscols.clst |
LCX_CLUSTERED | LOP_COUNT_DELTA | sys.sysrscols.clst |
LCX_CLUSTERED | LOP_COUNT_DELTA | sys.sysrscols.clst |
LCX_CLUSTERED | LOP_COUNT_DELTA | sys.sysrscols.clst |
LCX_CLUSTERED | LOP_COUNT_DELTA | sys.sysrscols.clst |
LCX_CLUSTERED | LOP_COUNT_DELTA | sys.sysrscols.clst |
LCX_CLUSTERED | LOP_COUNT_DELTA | sys.sysrscols.clst |
LCX_CLUSTERED | LOP_COUNT_DELTA | sys.sysrscols.clst |
LCX_CLUSTERED | LOP_COUNT_DELTA | sys.sysrscols.clst |
LCX_CLUSTERED | LOP_COUNT_DELTA | sys.sysallocunits.clust |
LCX_CLUSTERED | LOP_COUNT_DELTA | sys.sysrowsets.clust |
LCX_CLUSTERED | LOP_COUNT_DELTA | sys.sysallocunits.clust |
LCX_CLUSTERED | LOP_COUNT_DELTA | sys.sysrowsets.clust |
LCX_CLUSTERED | LOP_COUNT_DELTA | sys.sysrscols.clst |
LCX_CLUSTERED | LOP_COUNT_DELTA | sys.sysrscols.clst |
LCX_CLUSTERED | LOP_COUNT_DELTA | sys.sysrscols.clst |
LCX_CLUSTERED | LOP_COUNT_DELTA | sys.sysallocunits.clust |
LCX_CLUSTERED | LOP_COUNT_DELTA | sys.sysrowsets.clust |
LCX_NULL | LOP_BEGIN_CKPT | NULL |
LCX_FILE_HEADER | LOP_MODIFY_STREAMFILE_HDR | NULL |
LCX_BOOT_PAGE_CKPT | LOP_XACT_CKPT | NULL |
LCX_NULL | LOP_END_CKPT | NULL |
LCX_NULL | LOP_HK | NULL |
LCX_NULL | LOP_HK | NULL |
LCX_NULL | LOP_HK | NULL |
LCX_NULL | LOP_HK_CHAINED | NULL |
LCX_NULL | LOP_HK | NULL |
LCX_NULL | LOP_HK | NULL |
LCX_NULL | LOP_BEGIN_XACT | NULL |
LCX_NULL | LOP_FS_DOWNLEVEL_OP | NULL |
LCX_NULL | LOP_BEGIN_XACT | NULL |
LCX_CLUSTERED | LOP_INSERT_ROWS | sys.filestream_tombstone_2073058421.FSTSClusIdx |
LCX_INDEX_LEAF | LOP_INSERT_ROWS | sys.filestream_tombstone_2073058421.FSTSNCIdx |
LCX_NULL | LOP_COMMIT_XACT | NULL |
LCX_MARK_AS_GHOST | LOP_DELETE_ROWS | sys.filestream_tombstone_2073058421.FSTSClusIdx |
LCX_PFS | LOP_SET_BITS | sys.filestream_tombstone_2073058421.FSTSClusIdx |
LCX_MARK_AS_GHOST | LOP_DELETE_ROWS | sys.filestream_tombstone_2073058421.FSTSNCIdx |
LCX_PFS | LOP_SET_BITS | sys.filestream_tombstone_2073058421.FSTSNCIdx |
LCX_NULL | LOP_HK_CHAINED | NULL |
LCX_NULL | LOP_HK_CHAINED | NULL |
LCX_NULL | LOP_HK_CHECKPOINT | NULL |
LCX_NULL | LOP_FS_DOWNLEVEL_OP | NULL |
LCX_HEAP | LOP_INSERT_ROWS | sys.xtp_storage |
LCX_INDEX_LEAF | LOP_INSERT_ROWS | sys.xtp_storage.UQ__xtp_stor__3213E83EA8737D06 |
LCX_NULL | LOP_COMMIT_XACT | NULL |
LCX_NULL | LOP_BEGIN_XACT | NULL |
LCX_NULL | LOP_FS_DOWNLEVEL_OP | NULL |
LCX_NULL | LOP_BEGIN_XACT | NULL |
LCX_CLUSTERED | LOP_INSERT_ROWS | sys.filestream_tombstone_2073058421.FSTSClusIdx |
LCX_INDEX_LEAF | LOP_INSERT_ROWS | sys.filestream_tombstone_2073058421.FSTSNCIdx |
LCX_NULL | LOP_COMMIT_XACT | NULL |
LCX_MARK_AS_GHOST | LOP_DELETE_ROWS | sys.filestream_tombstone_2073058421.FSTSClusIdx |
LCX_MARK_AS_GHOST | LOP_DELETE_ROWS | sys.filestream_tombstone_2073058421.FSTSNCIdx |
LCX_NULL | LOP_FS_DOWNLEVEL_OP | NULL |
LCX_HEAP | LOP_INSERT_ROWS | sys.xtp_storage |
LCX_INDEX_LEAF | LOP_INSERT_ROWS | sys.xtp_storage.UQ__xtp_stor__3213E83EA8737D06 |
LCX_NULL | LOP_COMMIT_XACT | NULL |
LCX_NULL | LOP_HK | NULL |
LCX_CLUSTERED | LOP_EXPUNGE_ROWS | sys.filestream_tombstone_2073058421.FSTSClusIdx |
LCX_CLUSTERED | LOP_EXPUNGE_ROWS | sys.filestream_tombstone_2073058421.FSTSClusIdx |
LCX_INDEX_LEAF | LOP_EXPUNGE_ROWS | sys.filestream_tombstone_2073058421.FSTSNCIdx |
LCX_INDEX_LEAF | LOP_EXPUNGE_ROWS | sys.filestream_tombstone_2073058421.FSTSNCIdx |
LCX_PFS | LOP_SET_BITS | sys.filestream_tombstone_2073058421.FSTSClusIdx |
LCX_PFS | LOP_SET_BITS | sys.filestream_tombstone_2073058421.FSTSNCIdx |
LCX_PFS | LOP_MODIFY_HEADER | Unknown Alloc Unit |
总结
内存优化表也会写事务日志的,在读写操作的时候发现内存优化表没有I/O次数,应该是数据都已经在内存里了
更多详细资料可以参考:
SQL Server 2014 新特性——内存数据库
SQL Server 2014新特性:分区索引和内存优化表
MSDN:内存优化表
如有不对的地方,欢迎大家拍砖o(∩_∩)o