﻿<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title>SQL Server Blog</title>
	<updated>2008-11-19T22:19:33Z</updated>
	<id>http://sqlblog.maneffa.com/atom.aspx</id>
	<link rel="self" href="http://sqlblog.maneffa.com/atom.aspx" />
	<link rel="alternate" href="http://sqlblog.maneffa.com" />
	<generator uri="http://app.onlinequickblog.com/" version="2.0">Quick Blogcast</generator>
	<entry>
		<title>Profiler performance on laptops - what has least performance impact?</title>
		<link rel="alternate" href="http://sqlblog.maneffa.com/2008/04/17/profiler-performance-on-laptops.aspx?ref=rss" />
		<id>tag:sqlblog.maneffa.com,2008-04-17:24e0fc0c-16b1-4633-a55c-8f5cc64d4532</id>
		<author>
			<name>Nigel Maneffa</name>
		</author>
		<updated>2008-04-17T22:34:35Z</updated>
		<published>2008-04-17T21:41:00Z</published>
		<content type="html"><![CDATA[<P>‘Everyone’ knows that it is much more efficient to run a 'server side trace' than a 'GUI trace'. I have always been sceptical of this statement, as I prefer to be able to take a ‘peek’ at the GUI every hour or so, which you cannot do with a server side trace, and did not believe there could be that much overhead in running a GUI. However, I was proved wrong, but not for the reasons I originally thought.</P>
<P>I was recently running profiler on my laptop (ie single disk for OS, application db’s, tempdb, logs, temp directory etc etc) in GUI mode – the performance reduction on SQL write operations was incredible. So I started to think...<BR>What setup would give me the least profiler overhead?<BR>1)&nbsp;Local GUI trace<BR>2)&nbsp;Remote GUI trace (using profiler on another machine collecting data from my laptop over the network)<BR>3)&nbsp;Local server side trace</P>
<P>The local server side trace was by far the most efficient. It was so far ahead I could not believe it.<BR>An insert operation loop (ie lots of writes) that took 25 seconds without profiler took 35 seconds with a server side trace but a massive 141 seconds with a local GUI trace. A remote trace took 56 seconds.</P>
<P>What was the cause of this massive performance difference?</P>
<P>The answer was simple – I monitored the disk IO and found that GUI mode profiler makes lots of small writes, but a server side trace makes much smaller numbers of larger disk writes – it’s as simple as that!<BR>If you choose to save the GUI mode to a specific file location (as opposed to just looking at screen monitoring), the GUI makes 2 disk write operations, one write to the temp directory and one write to the 'save to' location dropping the performance even more – the insert operation above taking an incredible 206 seconds. If you want to save to a file and use the GUI it may be better to save the trace manually after it has completed.<BR><BR>Disk IO continues to become more of a bottleneck on single disk computers, where disk IO intensive systems such as databases show a startling performance drop off when there is a lot of (presumably) non sequential disk writes.<BR><BR>Here is a chart of the time taken - drop me a line if you need help understanding the detail<BR><BR>
<TABLE cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD><STRONG><FONT size=1>&nbsp;Parameter</FONT></STRONG></TD>
<TD><STRONG><FONT size=1>No Profiler&nbsp;</FONT></STRONG></TD>
<TD><STRONG><FONT size=1>Local GUI - no save&nbsp;to file</FONT></STRONG></TD>
<TD><STRONG><FONT size=1>&nbsp;Local GUI + save to file</FONT></STRONG></TD>
<TD><STRONG><FONT size=1>&nbsp;Local GUI -&nbsp;temp dir on USB</FONT></STRONG></TD>
<TD><STRONG><FONT size=1>Server Side Trace&nbsp;</FONT></STRONG></TD>
<TD><STRONG><FONT size=1>Remote Trace&nbsp;</FONT></STRONG></TD></TR>
<TR>
<TD><FONT size=1>Profiling Local or remote</FONT></TD>
<TD><FONT size=1>&nbsp;Local</FONT></TD>
<TD><FONT size=1>&nbsp;Local</FONT></TD>
<TD><FONT size=1>&nbsp;Local</FONT></TD>
<TD><FONT size=1>&nbsp;Local</FONT></TD>
<TD><FONT size=1>&nbsp;Local</FONT></TD>
<TD><FONT size=1>&nbsp;Remote</FONT></TD></TR>
<TR>
<TD><FONT size=1>Profiler GUI ON</FONT></TD>
<TD><FONT size=1>&nbsp;n/a</FONT></TD>
<TD><FONT size=1>&nbsp;Yes</FONT></TD>
<TD><FONT size=1>&nbsp;Yes</FONT></TD>
<TD><FONT size=1>&nbsp;Yes</FONT></TD>
<TD><FONT size=1>&nbsp;NO = 'server side trace'</FONT></TD>
<TD><FONT size=1>&nbsp;&nbsp;n/a</FONT></TD></TR>
<TR>
<TD><FONT size=1>Temp Directory</FONT></TD>
<TD><FONT size=1>&nbsp;n/a</FONT></TD>
<TD><FONT size=1>&nbsp;c:\...(local)</FONT></TD>
<TD><FONT size=1>&nbsp;c:\...(local)</FONT></TD>
<TD><FONT size=1>&nbsp;d:\...(Ext US</FONT></TD>
<TD><FONT size=1>&nbsp;&nbsp;c:\...(local)</FONT></TD>
<TD><FONT size=1>&nbsp;&nbsp;n/a</FONT></TD></TR>
<TR>
<TD><FONT size=1>&nbsp;Profiler 'Save to file'</FONT></TD>
<TD><FONT size=1>&nbsp;n/a</FONT></TD>
<TD><FONT size=1>&nbsp;n/a</FONT></TD>
<TD><FONT size=1>&nbsp;c:\...(local)</FONT></TD>
<TD><FONT size=1>No</FONT></TD>
<TD><FONT size=1>&nbsp;&nbsp;c:\...(local)</FONT></TD>
<TD><FONT size=1>&nbsp;&nbsp;n/a</FONT></TD></TR>
<TR>
<TD><FONT size=1>Network bandwidth (gigabit)</FONT></TD>
<TD><FONT size=1>&nbsp;n/a</FONT></TD>
<TD><FONT size=1>&nbsp;n/a</FONT></TD>
<TD><FONT size=1>&nbsp;n/a</FONT></TD>
<TD><FONT size=1>&nbsp;n/a</FONT></TD>
<TD><FONT size=1>&nbsp;n/a</FONT></TD>
<TD><FONT size=1>&nbsp;6%</FONT></TD></TR>
<TR>
<TD><FONT size=1>&nbsp;Time seconds</FONT></TD>
<TD><FONT size=1>&nbsp;25</FONT></TD>
<TD><FONT size=1>&nbsp;141</FONT></TD>
<TD><FONT size=1>&nbsp;206</FONT></TD>
<TD><FONT size=1>&nbsp;124</FONT></TD>
<TD><FONT size=1>&nbsp;35</FONT></TD>
<TD><FONT size=1>&nbsp;56</FONT></TD></TR></TBODY></TABLE></P>This image shows this disk IO activity in the worst case scenario of selecting&nbsp;a specific file location for the trace, as well as running the GUI,&nbsp;where profiler is writing the same data twice, dragging down performance even more.<BR><BR><IMG style="WIDTH: 541px; HEIGHT: 486px" height=520 src="http://images.quickblogcast.com/108356-101191/diskio.jpg" width=601 border=0><BR><BR>Happy profiling – server side of course!<BR><BR>]]></content>
	</entry>
	<entry>
		<title>SQL Server 2000 SP4 Upgrade Deleted Column Non-Convergence</title>
		<link rel="alternate" href="http://sqlblog.maneffa.com/2008/01/23/sql-server-2000-sp4-upgrade-deleted-column-nonconvergence.aspx?ref=rss" />
		<id>tag:sqlblog.maneffa.com,2008-01-23:913ff3eb-b18e-49ea-991f-bcddc33f5970</id>
		<author>
			<name>Nigel Maneffa</name>
		</author>
		<updated>2008-01-23T00:05:53Z</updated>
		<published>2008-01-23T00:04:00Z</published>
		<content type="html"><![CDATA[Sometimes the simplest solutions are the best. This was certainly the case shortly after an upgrade from SQL2000 SP3 to SP4 started creating non convergence on a large table with significant numbers of deleted / added columns. On closer inspection the problem only affected the publisher on updates, where the field next to the target field was being updated when the change reached the subscribers.<BR><BR>Publisher insert/delete and subscriber insert/delete/update worked fine.<BR>Either colv1 was being updated incorrectly by the merge trigger (most likely an error in @missingbm) or the stored procedure that applies the update was wrong. Either way it was a major problem.<BR>I thought that adding a new dummy field might ‘throw a spanner in the works’ so I tried it on the test system (an exact restore to a computer of the same name to make sure the deleted columns were still ‘ghosts’ in the merge tables) and amazingly the problem was fixed.<BR><BR>I applied the ‘fix’ to the production server and that was fixed as well. Sometimes it pays to try the simple things first.]]></content>
	</entry>
	<entry>
		<title>Non-Convergence Bug in SQL2005</title>
		<link rel="alternate" href="http://sqlblog.maneffa.com/2008/01/23/nonconvergence-bug-in-sql2005.aspx?ref=rss" />
		<id>tag:sqlblog.maneffa.com,2008-01-23:00681849-a35c-4c0b-a682-9a0d027cd254</id>
		<author>
			<name>Nigel Maneffa</name>
		</author>
		<updated>2008-01-23T00:03:56Z</updated>
		<published>2008-01-23T00:02:00Z</published>
		<content type="html"><![CDATA[<P>I recently reported an SP2 bug that creates non-convergence in merge publications with horizontal and join filters to MS. They are currently investigating. It only seems to affect new SQL2005 SP2 publications and SQL2000 that has been 'directly' upgraded to SQL2005 SP2 before having the snapshot run.<BR>I recommend you check out that this bug does not affect any new publications you have planned. It can catch you unawares since you just expect the functionality to work, it having worked so well in the past. I have found that correctly fixing non-convergence on partitioned data in a production environment where you have lots of tables and filtering is a distinctly non trivial activity, especially as the bug will typically move over new child records, but not the originals!<BR><BR>My current workaround is to delete the out of sync parent and child (more complex in my real life scenario as there are multiple join filters at various levels) and reinsert with the correct partition data already set. Fortunately, there are not many of these errors to contend with and the custom application now checks for this new 'feature' so the data can be corrected quickly. The normal fix for non-convergence, sp_mergedummyupdate, does not work in this scenario, when run on either the parent or child record(s). Newly inserted child records move to the correct partition however. So in summary, the child records that should be moved into the new partition at the time of partition change remain trapped in a non-converging limbo.<BR><BR>A potential workaround is to change the value of the merge publication option @use_partition_groups to false, as this forces(?) the older 'setupbelongs' functionality (evaluate partition membership at sync time) to be used. Unfortunately, due to the nature of this bug you cannot change the value of this setting in an existing publication, create a new snapshot and be on your way. You must first drop existing publications and create them with the @use_partition_groups set to false. You will need to experiment on your test environment for what works best for you. I did not test all eventualities in this area. The problem is that the merge GUI nearly always chooses the new feature precomputed partitions. </P>
<P><SPAN lang=EN-GB style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"><FONT face=Verdana>To give you a feel of what this bug might do in practise I have created a simplified version in the form of a story - </FONT><A href="http://www.replicationanswers.com/PartitionBugInMerge2005.asp"><FONT face=Verdana>the poor DBA</FONT></A><FONT face=Verdana>. </FONT></SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"><SPAN class=280431209-09052007><EM><FONT face=Verdana>...</FONT></EM></SPAN></SPAN></P>]]></content>
	</entry>
	<entry>
		<title>Merge Trace Logs</title>
		<link rel="alternate" href="http://sqlblog.maneffa.com/2008/01/22/merge-trace-logs.aspx?ref=rss" />
		<id>tag:sqlblog.maneffa.com,2008-01-22:c3f446c9-6c8d-4073-affe-bd4b16d14127</id>
		<author>
			<name>Nigel Maneffa</name>
		</author>
		<updated>2008-01-23T00:01:04Z</updated>
		<published>2008-01-22T23:59:00Z</published>
		<content type="html"><![CDATA[<P>In SQL2005 a new merge trace log is automatically maintained by SQL server. This is primarily of use when you have a problem, as it shows the internal workings of synchronisation. If you do run into problems, it’s well worth taking a look into here. There appear to be 3 files, a current log called replmerg.log, and 2 previous 10 meg log files named replmerg.log.1 and replmerg.log.2. These log files continually roll over so there are never more than 3 files.</P>
<P>I suspect MS added this auto logging as it would take considerable time for PSS to talk someone who knew little about replication to create a log file in SQL2000 by running the merge agent from the command line or modifying the job steps . These ready made files are always ready to go once the synchronisation has completed.</P>
<P>The log files will be found typically in the folder:</P>
<P>C:\Program Files\Microsoft SQL Server\90\COM\</P>]]></content>
	</entry>
</feed>