这只是很简单的一个测试。
做这个测试,只是想让不懂的人不要乱说sql每秒只能插入50条数据。
服务器配置我也不清楚。
大概是。
四核的2.8G
内存2G?
代码
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[test](
[id] [int] IDENTITY(1,1) NOT NULL,
[content] [varchar](50) NULL,
CONSTRAINT [PK_test] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
declare @dateNow datetime ,@i int
set @dateNow=getdate()
set @i=1
while @i<10000
begin
INSERT INTO [SD_Active].[dbo].[test]
([content])
VALUES
('testdddddddddddddddddddddddddddddddddd')
set @i=@i+1
end
select getdate()-@dateNow
--结果 1900-01-01 00:01:01.590
select 10000/61.59
--结果 每秒 162.364020 条
truncate table test
--先插入十条数据
declare @i int
set @i=1
while @i<=10
begin
INSERT INTO [SD_Active].[dbo].[test]
([content])
VALUES
('testdddddddddddddddddddddddddddddddddd')
set @i=@i+1
end
---------
declare @dateNow datetime ,@i int
set @dateNow=getdate()
set @i=1
while @i<20
begin
INSERT INTO [test]
([content])
select [content] from test
set @i=@i+1
end
select getdate()-@dateNow
--结果 1900-01-01 00:01:13.847
select (5242880-10)/73.847
--结果 每秒 70996.384416 条
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[test](
[id] [int] IDENTITY(1,1) NOT NULL,
[content] [varchar](50) NULL,
CONSTRAINT [PK_test] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
declare @dateNow datetime ,@i int
set @dateNow=getdate()
set @i=1
while @i<10000
begin
INSERT INTO [SD_Active].[dbo].[test]
([content])
VALUES
('testdddddddddddddddddddddddddddddddddd')
set @i=@i+1
end
select getdate()-@dateNow
--结果 1900-01-01 00:01:01.590
select 10000/61.59
--结果 每秒 162.364020 条
truncate table test
--先插入十条数据
declare @i int
set @i=1
while @i<=10
begin
INSERT INTO [SD_Active].[dbo].[test]
([content])
VALUES
('testdddddddddddddddddddddddddddddddddd')
set @i=@i+1
end
---------
declare @dateNow datetime ,@i int
set @dateNow=getdate()
set @i=1
while @i<20
begin
INSERT INTO [test]
([content])
select [content] from test
set @i=@i+1
end
select getdate()-@dateNow
--结果 1900-01-01 00:01:13.847
select (5242880-10)/73.847
--结果 每秒 70996.384416 条