Symptoms
Assume that you use precomputed partitions in merge replication with parameterized and join filters in Microsoft SQL Server 2012 or Microsoft SQL Server 2014. When you try to use the INSERT statement in tables at the root of the filter (on Publisher side), you may experience decreased performance on INSERT.
Resolution
After you apply this hotfix, you must execute the sp_vupgrade_mergeobjects procedure manually on the published database. It can help regenerate the article-specific triggers, stored procedures, and views that are used to track and apply data changes for the merge replication.
The issue was first fixed in the following cumulative update of SQL Server.
Cumulative Update 5 for SQL Server 2014 /en-us/help/3011055
Cumulative Update 3 for SQL Server 2012 SP2 /en-us/help/3002049
Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:
More Information
INSERT into <Table> triggers Merge INSERT trigger MSmerge_ins_XXXX, and the trigger calls the procedure MSmerge_expand_sp_XXXX.
If you encounter this issue, you will notice that the following Insert/Select Distinct statement of the Merge expansion procedure MSmerge_expand_sp_XXXX consumes much time. In this situation, the performance of INSERT decreases.
insert into dbo.MSmerge_current_partition_mappings with (rowlock) (publication_number, tablenick, rowguid, partition_id)
select distinct 1, mc.tablenick, mc.rowguid, v.partition_id
from dbo.MSmerge_contents mc with (rowlock)
JOIN dbo.[MSmerge_dynamic_filter_merge_new_settings_PARTITION_VIEW] v with (rowlock)
ON mc.tablenick = <tablenick>
and mc.rowguid = v.[rowguid]
and mc.marker = @child_marker
and v.partition_id in (select partition_id from dbo.MSmerge_current_partition_mappings cpm with (rowlock) JOIN
dbo.MSmerge_contents mc2 with (rowlock)
ON cpm.rowguid = mc2.rowguid
and mc2.marker = @marker)
where not exists (select * from MSmerge_current_partition_mappings with (readcommitted, rowlock, readpast) where
publication_number = 1 and
tablenick = <tablenick> and
rowguid = v.[rowguid] and
partition_id = v.partition_id)
Status
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.