If destination already has the changes, how Sync Framework can avoid running enumeration queries RRS feed

  • Question

  • I am using sync framework 2.1, sqlsyncprovider 

    When sync session is in process, I ran the sql profiler on the databases and found that sync fx executing select changes stored procedure for all tables in a scope.

    Can we avoid this un necessary requests to databases If each table in destination has all of the changes from the source.

    Please advice.



    Monday, June 24, 2013 1:50 PM

All replies

  • then why sync when you know you have all the changes already?

    Monday, June 24, 2013 1:54 PM
  • For example In my scope I have 10 tables.

    Sync fx executing select changes procedure for all tables in a scope even if there are no changes in few tables since last synchronization.

    So can we identify tables that are changed and run commands for them.


    Monday, June 24, 2013 2:12 PM
  • I need following feature 

    • For DbSyncProvider, use SelectTableMaxTimestampsCommand to optimize enumeration.

      The query that is specified for this property selects the maximum timestamp from each base table or tracking table. This timestamp is used to determine whether for each table the destination already has all of the changes from the source. If the destination already has the changes, Sync Framework can often avoid running enumeration queries, which can improve performance.

    • source:http://msdn.microsoft.com/en-us/library/dd937463.aspx

    I need help for how to do this for sqlsyncprovider.

    Please advice.


    Monday, June 24, 2013 2:14 PM
  • the scope is your grouping of tables to synchronize. you cannot selectively specify dynamically which tables to include or not.

    you may know that there are no changes to your table but sync fx does not, that's why it has to fire a query.

    if there are no changes to sync, that's just one query to the table.

    you use the selecttablemaxtimestampscommand and your scanning the entire table to get the max value. then, if there are changes to the table, it will have to fire the selectchanges again to retrieve the changes.

    Monday, June 24, 2013 2:32 PM
  • I agree with you JuneT. Thx for your support

    But I have one question:

    On provider, do we have an option to override the code that calls these stored procedures [Control what table commands to be executed]. May be in future if there is any need I can use that feature.


    Monday, June 24, 2013 2:50 PM
  • you can write your own sync provider that inherits from DbSyncProvider, have a look at the approach here: http://jtabadero.wordpress.com/2010/03/05/passing-dynamic-filter-values-to-sync-framework-collaboration-scenario-sync-scopes/

    Tuesday, June 25, 2013 1:36 AM