r/SQLServer • u/techsamurai11 • Nov 05 '25
Discussion Processing Speed of 10,000 rows on Cloud
Hi, I'm interested in cloud speeds for SQL Server on AWS, Azure, and Google Cloud.
Can people please run this very simply script to insert 10,000 rows from SSMS and post times along with drive specs (size and Type of VM if applicable, MiB, IOPS)
If you're on-prem with Gen 5 or Gen 4 please share times as well for comparison - don't worry, I have ample Tylenol next to me to handle the results:-)
I'll share our times but I'm curious to see other people's results to see the trends.
Also, if you also have done periodic benchmarking between 2024 and 2025 on the same machines, please share your findings.
Create Test Table
CREATE TABLE [dbo].[Data](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Comment] [varchar](50) NOT NULL,
[CreateDate] [datetime] NOT NULL,
CONSTRAINT [PK_Data] 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
Test Script
SET NOCOUNT ON
DECLARE u/StartDate DATETIME2
SET u/StartDate = CURRENT_TIMESTAMP
DECLARE u/CreateDate DATETIME = GETDATE()
DECLARE u/INdex INT = 1
WHILE u/INdex <= 10000
BEGIN
INSERT INTO Data (Comment, CreateDate)
VALUES ('Testing insert operations', CreateDate)
SET u/Index +=1
IF (@Index % 1000) = 0
PRINT 'Processed ' + CONVERT(VARCHAR(100), u/Index) + ' Rows'
END
SELECT DATEDIFF(ms, u/StartDate, CURRENT_TIMESTAMP)
15
u/VladDBA Microsoft MVP Nov 05 '25
Why would you use a RBAR approach instead of a set-based one to write 10k records?
If you want to test disk write speeds in environments where you cannot do proper storage benchmarks (with CrystalDiskMark for example), I wrote a script that does this from the database side which might be more helpful.
8
u/dbrownems Microsoft Employee Nov 05 '25 edited Nov 05 '25
Without a transaction this will commit after each insert statement. So you’re only testing the log disk write IOPS.
I ran this locally and it took about 1900ms as-is, and 100ms when wrapped in a transaction.
4
u/Intrexa Nov 05 '25
And violate the DeWitt clause? Nice try, corporate lawyers.
4
u/jshine13371 6 Nov 05 '25
As others have said, this is a poor way to achieve the goal you're looking for.
A simpler way is to just read the docs and use common sense comparisons. Literally copying an exact comment I made a few weeks ago on this:
To re-iterate, disks on the cloud are slow and costly. But if you can 🐎-up the 💵 then you can make it manageable. Or you can re-write all your code to be more efficient / do less and scrape by. Cheers!
3
u/No_Resolution_9252 Nov 05 '25
What are you even wanting this useless test for?
For one, this is RBAR and the performance wouldn't be that different on a 5 year old laptop vs pretty much any VM of any size.
3
u/mauridb Nov 05 '25 edited Nov 05 '25
This sample I created time ago should help you to get all the answer you need: https://github.com/yorek/azure-sql-db-samples/tree/master/samples/07-network-latency. The sample was done for showcasing impact of network latency and what are the best practices to minimize it, but it seems that is applicable to also your case.
1
u/techsamurai11 Nov 06 '25
Here are the results of the concurrency insert testing.
Test 1
Concurrent Inserts of 100k rows 5 times - 500k Rows
Test 2
Concurrent Inserts of 100k rows 13 times - 1.3 Million Rows
Why 5 and 13? I've no clue but these are individual transaction written to the log of Database A.
While testing the 500k and 1.3 million, we are also inserting 100k rows into Database B.
Why? The 2nd database is meant as a control to determine if there's a global bottleneck somewhere. If Database A is suffering but Database B executes in the exact time it normally would without any activity on the server, then obviously the server is not bottlenecked anywhere.
Row 1 - The default GP3 drive is 125 MiB and 3,000 IOPS
Database A had a penalty of 30% for 500k rows and a penalty of 180%-200% for 1.3 million. It struggled with 1.3 million. It's the only row running SQL Server 2016.
Oddly enough, Database B felt nothing while inserting 100k rows - it was oblivious to whatever was happening to Database A.
Row 2 - Same instance type, higher IOPS
Database A - The penalty at the 500k rows went away so the IOPS helped or SQL Server 2022 did that. I'll figure that out. There was a 20-30% penalty for 1.3 million rows.
Database B - no penalty for 500k but a penalty at 1.3 million - the only time Database B was penalized for Database A activity so we must have hit a limit somewhere.
Row 3 - Same instance type, much higher IOPS
The important part about this is the general lack of penalties, other than a 3% penalty for 1.3 million rows, and the fact that it shares that with Row 4.
Row 4 - Better instance type
No penalties, other than 3% for 1.3 million rows.
Summary Thoughts
These are inserts - deletes and updates should behave the same and I might test it but I've updated and deleted so many records that I expect the numbers to be identical to the second.
There were no deadlocks or errors. All records were processed.
Theoretically speaking if you had 1.3 million orders over 2 minutes, you'd have processed them.
Notice the value of 98-100 appearing everywhere - this is a constant for RBAR so single transaction speed seems to be the same regardless of specs. I'm not sure if a VM with 800 CPUs could break the number by anything meaningful. You need to avoid RBAR, if possible.
It's not as fast as on-premise.
Based on this testing, it's hard to make the case for the r6a-2xlarge except for the extra memory and higher compute.
Please share your thoughts.
1
u/SQLBek 1 Nov 05 '25
What "aspects" of "cloud speed" are you attempting to measure here?
All your test is really going to do is send data over the wire from wherever the SSMS instance is to the target database... And write some t-log data to disk. Whether the data pages get written to disk in your time frame is variable. IO pathways matter here. And something of this scale, even a small VM in the cloud should handle in a trivial fashion. But all of that also makes other assumptions like zero neighboring workload, etc.
So to be blunt, I say stop - what are you wanting to prove or disprove here? What's your problem statement or situation?
1
u/Dry_Author8849 Nov 05 '25
It depends on your cloud instance. Instances come with some IOPS limits depending on instance type.
Also, what's your setup on prem? Which hardware? Cluster? SAN?
Running it without any context will tell you nothing.
1
u/SQLBek 1 Nov 05 '25
Starting a new thread.
Based on your piecemeal answers elsewhere, I believe that you believe that GP storage on your AWS EC2 instances suck. That may be the case, but using a script like the above is not a reliable way to test.
Instead, I'll suggest that you use a script like one that I share here (or one of the ones I reference). THAT will measure you file level I/O on your SQL Server. It'll measure latency, IOPs, and throughput, in addition to a few other things.
https://sqlbek.wordpress.com/2023/11/29/dmv-script-for-diagnosing-storage-performance/
My variant will take a "snapshot" of perf metrics, then you must run some kind of workload, then take another snap of those perf metrics, then output a delta.
However, make sure that whatever workload you choose to run as your test actually writes I/O. As pointed out elsewhere, SQL Server uses WAL protocol, meaning data pages are NOT hardened to disk immediately after DML occurs.
More resources about storage engine internals. Long story short with the below, storage engine I/O behavior is not the simple construct you seem to think it is.
https://learn.microsoft.com/en-us/sql/relational-databases/query-processing-architecture-guide?view=sql-server-ver17
https://learn.microsoft.com/en-us/sql/relational-databases/memory-management-architecture-guide?view=sql-server-ver17
https://learn.microsoft.com/en-us/sql/relational-databases/sql-server-storage-guide?view=sql-server-ver17
1
u/MerlinTrashMan Nov 05 '25
My results are on-prem after 50 runs (990pro 4tb):
475ms for original script.
84ms for transaction wrapped version.
2
u/az987654 Nov 05 '25
Useless
0
u/techsamurai11 Nov 05 '25 edited Nov 05 '25
Is there a reason why inserting 10,000 rows with auto-commit for each row would run in 84ms in one query window and 9703ms in another one? That's 1 vs 100x performance.
Apparently, this was a bug - this is my weirdest database day of all time. If you were to combine all the data over the past 20 years, this would collectively beat it.
0
u/techsamurai11 Nov 06 '25
Okay, so I complicated the test by inserting 100k rows in 5 windows of SSMS (local) and another 100k rows in another database (different log file).
Atomic Transactions: 5x100k in 1 table and 100k in another table.
CPU: practically idling so we are not even remotely loading the CPU:-)
The 5 insert operations are less important - they ended up with an overall 30% penalty - all finished so there was bit of a concurrency degradation but not much. We certainly did NOT exceed IOPS (read below).
The important part was that the inserts to the 2nd table and a different log file were completely unaffected by the other 5 other insert operations on the log file on the same drive. It completed its work in the exact time I would have predicted and I'm sure that it would have done so in the same time on any vm instance.
Is this network latency? Essentially, the network takes 1ms (0.98 to be exact) to make a round trip to the drive and back to the server.
That's the only factor I can think of that would render the CPU, drive, RAM, SQL server version almost irrelevant as we've been seeing.
And I also ran with 13 concurrent operations and the 2nd database script ran again in the exact time, as expected - oblivious to the craziness of the other database trying to insert 1.3 million rows - a penalty that was between 180-200%.