6,128
社区成员




SELECT top 1000000 *
FROM [dbo].[Consultation_Rvinfo1] order by H_Id
GO
SELECT top 1000000 *
FROM [dbo].Consultation_Rvinfo1_old order by H_Id
GO
create table [Test] (
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)
/* 以下部分重复执行,直到报错*/
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 = 1000000
declare @c nchar(48) = N'12345678901234567890123456789012345678'
----------------------------- --- disk-based table and interpreted Transact-SQL -----------------------------
delete from Test
set @i = 1
set @starttime = sysdatetime()
begin tran
while @i <= @rowcount
begin
insert into Test values (@i, @c)
set @i += 1
end
commit
set @timems = datediff(ms, @starttime, sysdatetime())
select '时间' + cast(@timems as varchar(10)) + ' ms'
----------------------------------------------------------------------------------
--下面这样执行也会运行到报错
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 = 10000000
declare @c nchar(48) = N'12345678901234567890123456789012345678'
----------------------------- --- disk-based table and interpreted Transact-SQL -----------------------------
delete from Test
set @i = 1
set @starttime = sysdatetime()
while @i <= @rowcount
begin
insert into Test values (@i, @c)
set @i += 1
end
set @timems = datediff(ms, @starttime, sysdatetime())
select '时间' + cast(@timems as varchar(10)) + ' ms'
资源池 'default' 没有足够的系统内存来运行此查询。