SQL2014内存表性能之内存中 OLTP 的性能改进测试
来源:互联网 发布:双系统mac 怎么切换 编辑:程序博客网 时间:2024/06/05 15:26
先贴1个例子,后续补充完整的测试例子....
1、用MSDN例子测试一下
use mastergo--1、先创建包含内存优化文件组的数据库CREATE DATABASE imoltp2ONPRIMARY(NAME = [imoltp2_data],FILENAME = 'd:\data\imoltp2_mod1.mdf', size=500MB), FILEGROUP [imoltp2_mod] CONTAINS MEMORY_OPTIMIZED_DATA( -- name of the memory-optimized filegroupNAME = [imoltp2_dir], -- logical name of a memory-optimized filegroup containerFILENAME = 'd:\data\imoltp2_dir') -- physical path to the containerLOG ON (name = [imoltp2_log], Filename='d:\data\imoltp2_log.ldf', size=500MB)GO--2、创建表和本机编译存储过程use imoltp2goIF EXISTS (SELECT name FROM sysobjects WHERE name = 'xx') DROP PROCEDURE xxGOIF EXISTS (SELECT name FROM sysobjects WHERE name = 'sql') DROP TABLE sqlGOIF EXISTS (SELECT name FROM sysobjects WHERE name = 'hash') DROP TABLE hashGOIF EXISTS (SELECT name FROM sysobjects WHERE name = 'hash1') DROP TABLE hash1GOcreate table [sql](c1 int not null primary key,c2 nchar(48) not null)gocreate table [hash](c1 int not null primary key nonclustered hash with (bucket_count=1000000),c2 nchar(48) not null) with (memory_optimized=on, durability = schema_and_data)gocreate table [hash1](c1 int not null primary key nonclustered hash with (bucket_count=1000000),c2 nchar(48) not null) with (memory_optimized=on, durability = schema_and_data)goCREATE PROCEDURE xx @rowcount int, @c nchar(48)WITH NATIVE_COMPILATION, SCHEMABINDING, EXECUTE AS OWNERAS BEGIN ATOMIC WITH (TRANSACTION ISOLATION LEVEL = SNAPSHOT, LANGUAGE = N'us_english') declare @i int = 1 while @i <= @rowcount begin INSERT INTO [dbo].[hash1] values (@i, @c) set @i += 1 endENDGO--3、演示内存优化表的性能set statistics time offset nocount on-- inserts - 1 at a timedeclare @starttime datetime2 = sysdatetime(), @timems intdeclare @i int = 1declare @rowcount int = 100000declare @c nchar(48) = N'12345678901234567890123456789012345678'-------------------------------- disk-based table and interpreted Transact-SQL-----------------------------begin tranwhile @i <= @rowcountbegin insert into [sql] values (@i, @c) set @i += 1endcommitset @timems = datediff(ms, @starttime, sysdatetime())select 'Disk-based table and interpreted Transact-SQL: ' + cast(@timems as varchar(10)) + ' ms'/*Disk-based table and interpreted Transact-SQL: 1996 ms*/-------------------------------- Interop Hash-----------------------------set @i = 1set @starttime = sysdatetime()begin tranwhile @i <= @rowcountbegin insert into [hash] values (@i, @c) set @i += 1endcommitset @timems = datediff(ms, @starttime, sysdatetime())select ' memory-optimized table w/ hash index and interpreted Transact-SQL: ' + cast(@timems as varchar(10)) + ' ms'/* memory-optimized table w/ hash index and interpreted Transact-SQL: 1478 ms */-------------------------------- Compiled Hash-----------------------------set @starttime = sysdatetime()exec xx @rowcount, @cset @timems = datediff(ms, @starttime, sysdatetime())select 'memory-optimized table w/hash index and native SP:' + cast(@timems as varchar(10)) + ' ms'/*memory-optimized table w/hash index and native SP:268 ms*/
引用:http://technet.microsoft.com/zh-cn/library/dn530757.aspx
0 0
- SQL2014内存表性能之内存中 OLTP 的性能改进测试
- 性能测试之内存泄漏
- 性能测试之内存泄漏
- 性能测试总结之内存泄露和内存溢出
- 性能测试总结之内存泄露和内存溢出
- 性能测试总结之内存泄露和内存溢出
- 性能测试总结之内存泄露和内存溢出
- 性能测试总结之内存泄露和内存溢出
- android性能测试之内存泄漏
- 性能测试瓶颈分析之内存泄漏
- 性能计数器之内存
- 性能计数器之内存
- 性能调优基础篇之内存测试常识
- Android性能测试之内存分析以及MAT工具
- 高性能之内存池
- 性能分析之内存优化
- 性能优化之内存泄露
- android 性能之内存浅析
- A-8SQL Server 触发器
- 我的博客
- A-9SQL Server 数据库安全
- Qt for Windows:Qt 5.4.0 MinGW 静态编译版本制作
- A-10SQL Server 开发指南
- SQL2014内存表性能之内存中 OLTP 的性能改进测试
- 自己珍藏的数据库SQL基础练习题答案
- 解决FindBLAS.cmake error LAPACK/BLAS: A required library with BLAS API not found.
- 把用某符号分隔的字符串转换成数组
- 短信猫smsLib for java二次开发系列问题解决探讨
- 数字图像处理学习笔记(1.2)---位图的读写、几何变换、傅里叶变换、直方图均衡
- netperf用法
- 漫谈选人与培训
- 【同步复制常见错误处理2】同步复制数据引起的同步失败错误