I bought a new server with spec : HP ProLiant ML310e Gen8 v2 8 GB Single Memory, Intel Xeon E3-1220v3 3,1 GHz, 500 GB SATA 7.5K RPM, Windows Server 2012 R2 x64, SQL Server Standard 2014 x64, RAID 0
Compared with my notebook : ASUS X200CA 2 GB Single Memory, Intel Celeron Dual Core 1.5 GHz, 500 GB SATA 7.5K RPM, Windows 7 Ultimate x64, SQL Server Express 2014 x64, AHCI
I just compared this notebook because the different too much compared with my old server (old server faster). I've setting few configuration with my new server and getting a little better from this post SQL Server 2012 slower than 2008
Testing : (5 Tries)
select top 9000 * from faktur_detail
New Server :
CPU time = 20 ms, elapsed time = 756 ms.
CPU time = 12 ms, elapsed time = 720 ms.
CPU time = 8 ms, elapsed time = 840 ms.
CPU time = 14 ms, elapsed time = 689 ms.
CPU time = 17 ms, elapsed time = 740 ms.
My Notebook :
CPU time = 250 ms, elapsed time = 2403 ms.
CPU time = 172 ms, elapsed time = 2541 ms.
CPU time = 219 ms, elapsed time = 2848 ms.
CPU time = 140 ms, elapsed time = 2426 ms.
CPU time = 172 ms, elapsed time = 2410 ms.
I had try update, insert and other normal commands and showed that new server faster than my notebook. The problem is with Cursor :
Testing : (5 Tries)
declare @ketqty varchar (50),
@ketqtyjual varchar (50),
@ketqtybonus varchar (50),
@kd_barang varchar (10),
@kd_rec int,
@qty numeric,
@qtyjual numeric,
@qtybonus numeric
DECLARE @RPREKAPJUALALL_Cursor CURSOR
SET @RPREKAPJUALALL_Cursor = CURSOR SCROLL DYNAMIC FOR
select kd_rec, qtyjual , qtyBonus , Qty, kd_barang from RPREKAPJUALALL where NamaKomputer ='serverhp'
OPEN @RPREKAPJUALALL_Cursor
FETCH NEXT FROM @RPREKAPJUALALL_Cursor INTO @kd_rec, @qtyjual,@qtybonus, @qty, @kd_barang
WHILE @@FETCH_STATUS = 0
BEGIN
EXEC sp_countsatuandetail @KD_BARANG, @qty , @RESULT = @ketqty OUTPUT
EXEC sp_countsatuandetail @KD_BARANG, @qtyjual , @RESULT = @ketqtyjual OUTPUT
EXEC sp_countsatuandetail @KD_BARANG, @qtybonus , @RESULT = @ketqtybonus OUTPUT
update RPREKAPJUALALL set ketqty =@ketqty , ketqtyjual =@ketqtyjual ,ketqtybonus =@ketqtybonus where NamaKomputer ='serverhp' and kd_rec =@kd_rec
FETCH NEXT FROM @RPREKAPJUALALL_Cursor INTO @kd_rec, @qtyjual,@qtybonus, @qty, @kd_barang
END
CLOSE @RPREKAPJUALALL_Cursor
DEALLOCATE @RPREKAPJUALALL_Cursor
New Server :
86 seconds.
93 seconds.
85 seconds.
83 seconds.
81 seconds.
My Notebook :
16 seconds.
12 seconds.
14 seconds.
18 seconds.
16 seconds.
I know cursors is really bad for SQL Server, but I can't switched all cursors into normal update soon, because previous programmers left so many cursors in stored procedure.
What possible caused this problem? I've struggling with this 2 weeks now. I've been read so many articles. I come into conclusion that this type of server is not fit become Database Server, because compared with old server, this server slower about 2,8 times even with SELECT command.
OLD Server : Intel Core i3, 1TB SATA HDD 7.5K RPM, 16GB Dual Memory, Windows 7 Ultimate x64, SQL Server 2008 Express x86.
For some reason, I must use this new server for now. Please help me with this Cursor problem for a while. This new server so slow for now even showing a week data. I can't imagine how this ended after 1 month, years.
Any Help will be appreciated. Thank you very much.