SQL2014内存表性能之内存中 OLTP 的性能改进测试
先贴1个例子,后续补充完整的测试例子....
1、用MSDN例子测试一下
use master
go
--1、先创建包含内存优化文件组的数据库
CREATE DATABASE imoltp2
ON
PRIMARY(NAME = [imoltp2_data],
FILENAME = 'd:\data\imoltp2_mod1.mdf', size=500MB)
, FILEGROUP [imoltp2_mod] CONTAINS MEMORY_OPTIMIZED_DATA( -- name of the memory-optimized filegroup
NAME = [imoltp2_dir], -- logical name of a memory-optimized filegroup container
FILENAME = 'd:\data\imoltp2_dir') -- physical path to the container
LOG ON (name = [imoltp2_log], Filename='d:\data\imoltp2_log.ldf', size=500MB)
GO --2、创建表和本机编译存储过程
use imoltp2
go IF EXISTS (SELECT name FROM sysobjects WHERE name = 'xx')
DROP PROCEDURE xx
GO IF EXISTS (SELECT name FROM sysobjects WHERE name = 'sql')
DROP TABLE sql
GO IF EXISTS (SELECT name FROM sysobjects WHERE name = 'hash')
DROP TABLE hash
GO IF EXISTS (SELECT name FROM sysobjects WHERE name = 'hash1')
DROP TABLE hash1
GO create table [sql]
(
c1 int not null primary key,
c2 nchar(48) not null
)
go create 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)
go create 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)
go CREATE PROCEDURE xx
@rowcount int,
@c nchar(48)
WITH NATIVE_COMPILATION, SCHEMABINDING, EXECUTE AS OWNER
AS
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
end
END
GO
--3、演示内存优化表的性能
set statistics time off
set nocount on -- inserts - 1 at a time declare @starttime datetime2 = sysdatetime(),
@timems int declare @i int = 1
declare @rowcount int = 100000
declare @c nchar(48) = N'12345678901234567890123456789012345678' -----------------------------
--- disk-based table and interpreted Transact-SQL
----------------------------- begin tran
while @i <= @rowcount
begin
insert into [sql] values (@i, @c)
set @i += 1
end
commit set @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 = 1
set @starttime = sysdatetime() begin tran
while @i <= @rowcount
begin
insert into [hash] values (@i, @c)
set @i += 1
end
commit set @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, @c set @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
SQL2014内存表性能之内存中 OLTP 的性能改进测试的更多相关文章
- 内存中OLTP(Hekaton)的排序警告
内存中OLTP是关于内存中的一切.但那只是对了一半.在今天的文章里我想给你展示下,当你从内存读取数据时,即使内存中OLTP也会引起磁盘活动.这里的问题是执行计划里,不正确的统计信息与排序(sort)运 ...
- 内存中 OLTP - 常见的工作负荷模式和迁移注意事项(三)
----------------------------我是分割线------------------------------- 本文翻译自微软白皮书<In-Memory OLTP – Comm ...
- SQL Server 内存中OLTP内部机制概述(二)
----------------------------我是分割线------------------------------- 本文翻译自微软白皮书<SQL Server In-Memory ...
- MySQL内存表-临时表
HEAP表是访问数据速度最快的MySQL表,他使用保存在内存中的散列索引.但如果MySQL或者服务器重新启动,表中数据将会丢失.用法:如论坛的在线人数统计,这种表的数据应该是无关紧要的,就几个简单的字 ...
- MySQL内存表的特性与使用介绍
国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html内部邀请码:C8E245J (不写邀请码,没有现金送)国内私 ...
- mysql之内存表
一.引言 昨天下午老大让我查资料看一下mysql的内存表在主从备份中是否能被复制,我还没听说过内存表呢,于是上网查资料,记录一下,以便查阅.学习 二.进展 参考: http://www.cnblogs ...
- 配置内存中OLTP文件组提高性能
在今天的文章里,我想谈下使用内存中OLTP的内存优化文件组来获得持久性,还有如何配置它来获得高性能.在进入正题前,我想简单介绍下使用你数据库里这个特定文件组,内存OLTP是如何获得持久性的. 内存中O ...
- 为什么我还不推荐内存中OLTP给用户
嗯,有些人在看玩这篇文章后会恨我,但我还是要说.1个月来我在内存中OLTP这个里领域里做了大量的工作,很多用户都请求使用这个惊艳的新技术.遗憾的是,关于内存中OLTP没有一个是真的令人激动的——看完你 ...
- 内存中 OLTP - 常见的工作负荷模式和迁移注意事项(二)
----------------------------我是分割线------------------------------- 本文翻译自微软白皮书<In-Memory OLTP – Comm ...
随机推荐
- Java魔法堂:自定义和解析注解
一.前言 注解(Annotation)作为元数据的载体,为程序代码本身提供额外的信息,使用过MyBatis等ORM框架的朋友对 @Insert 的注解应该不陌生了,这是MyBatis自定义的注解,显然 ...
- mysql 行锁一则
CREATE TABLE `t1` ( `id` int(11) NOT NULL DEFAULT '0', `name` varchar(20) DEFAULT NULL, PRIMAR ...
- 《构建之法》之第8、9、10章读后感 ,以及sprint总结
第8章: 主要介绍了软件需求的类型.利益相关者,获取用户需求分析的常用方法与步骤.竞争性需求分析的框架NABCD,四象限方法以及项目计划和估计的技术. 1.软件需求:人们为了解决现实社会和生活中的各种 ...
- 怎样实现Web控件文本框Reset的功能
在ASP.NET开发过程序,在数据插入之后,文本框TextBox控件需要Reset.如果只有一两个文件框也许没有什么问题,如果网页上有很多文本框,你就会有点问题了.再加上某一情形,一些文本框是有默认值 ...
- ADO.net中常用的对象介绍
ADO.NET的对象主要包括:DataSet,DataTable,DataColumn,DataRow,和DataRelation. DataSet:这个对象是一个集合对象,它可以包含任意数量的数据表 ...
- PHP实现过滤各种HTML标签
首先分享一些比较常见的 $str=preg_replace("/<s*imgs+[^>]*?srcs*=s*(''|")(.*?)\1[^>]*?/?s*> ...
- VB 2015 的 闭包(Closure)
是的,你没看错,这篇文章讲的不是 ECMAScript . 目前 VB 14 比 C# 6 领先的功能里面,有个即将在 C# 7 实现的功能,叫做"本地方法".这个功能与" ...
- csharp: get Web.Services WebMethod
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.We ...
- YAML初探
http://www.cnblogs.com/chwkai/archive/2009/03/01/249924.html 1 概念YAML是一种人们可以轻松阅读的数据序列化格式,并且它非常适合对动态编 ...
- USE “schema_name” in PostgreSQL
http://timmurphy.org/tag/mysql/ http://timmurphy.org/2009/11/17/use-schema_name-in-postgresql/ ===== ...