SQL Data Compare
Latest version: 10.0
Notes & articles
Getting better performance out of SQL Data Compare
SQL Data Compare can take a long time to compare and synchronize data sources. The speed of the comparison depends mostly on disk write speed, processor speed, memory, and the size of the databases. However, there are a number of things that you can do to get better performance out of SQL Data Compare.
This article explains how you can run faster comparisons and prevent your computer from running out of disk space. It also explains how to schedule the comparison and synchronization during periods of low database activity.
Running out of disk space
When you run a comparison, SQL Data Compare retrieves the data from the two data sources and copies the data to a temporary location on your local machine. If the SQL Servers are remote, the data is copied across the network to your local machine.
Although there is no limit on the size of the data sources that you can compare, the amount of available disk space will restrict the amount of data that SQL Data Compare can compare. You'll need roughly twice the size of the database for the comparison and up to four times the size of the database to generate the synchronization SQL.
If you do not have enough disk space, you can:
- change the location that SQL Data Compare uses for temporary files to a location with more disk space
- filter the data at table-level, column-level, or row-level so that the temporary files are smaller
- review the options for comparison behavior
Changing the location of the temporary files
By default, the location of the temporary files is defined by the TMP environment variable. You are not recommended to edit the TMP variable as this will affect all programs that use this variable. Instead, you create a new environment variable called RGTEMP, and specify the required location, for example a different hard disk with more disk space. The RGTEMP variable affects only Red Gate programs.
Note that you may need to log out of Windows® for the change to take effect.
Filtering the data
SQL Data Compare selects all tables, all columns, and all rows for comparison, so you'll be temporarily storing all the data that differs in the two data sources. By filtering the data, you compare only the data you're really interested in, and the size of the temporary files is reduced.
You filter data using the Tables & Views tab on the Project Configuration dialog box. The filtering techniques described here are useful when your tables contain a large amount of data that differs:
- Table filtering
Exclude all the data for a table by clearing its check box:

- Column filtering (vertical filtering)
Exclude all the data in particular columns by clicking in the Columns in Comparison box for the associated table, and then clearing the check boxes for the required columns:

- Row filtering (horizontal filtering)
Exclude rows by clicking WHERE Clause, and then typing a T-SQL WHERE clause in the box:

You can apply the same WHERE clause to multiple tables, by highlighting the required tables before opening the WHERE Clause Editor.
You can apply a different WHERE clause for each data source by clearing the Use the same WHERE clause for both data sources check box.
Note that row filtering is not available if you are using a backup as a data source.
Reviewing the options for comparison behavior
By default, SQL Data Compare includes identical values in the comparison results. If your data sources always contain similar data, clear the Show identical values in results check box on the Options tab of the Project Configuration dialog box. When you do this, SQL Data Compare does not store data that is identical, reducing the disk space that is required.
If you are comparing tables with large amounts of data that changes infrequently, select the Use checksum comparison check box. You'll need to clear the Show identical values in results check box before you do this. If the checksums are equal, SQL Data Compare won't compare that table, and the data is not stored for that table, reducing the disk space that is required.

Note that if your table contains large data types such as text or images, these columns are not included in the checksum, and you are not recommended to use the Use checksum comparison option.
Scheduling the comparison and synchronization
If you still find the comparison or the synchronization is taking too long to run, you may want to schedule these tasks to run at a time when your SQL Server has low levels of activity. To do this, you'll need the Pro edition of SQL Data Compare.
In SQL Data Compare version 6, when you set up your comparison project, you can save the project file wherever you want. You can then create a script with SQL Data Compare commands to open the comparison project and run the synchronization.
For example, you could create a batch file (.bat) as follows:
C:
cd path_to_SQLDataCompare_installation_folder
SQLDataCompare
/project:"D:\SQLDataCompare\Projects\Widgets.sdc"
/synchronize
You can then use the Microsoft® Windows® Scheduled Task wizard to run the batch file.
Summary
In this article, you've learned how to change the location of temporary files, filter the data before it is compared, and set the options that determine comparison behavior so that you don't run out of disk space. To find out more about setting up your comparison projects, see Selecting tables and views.
You've also learned how to schedule a comparison and synchronization using the command line. To see more examples using the command line, see Examples using the command line.
Was this article helpful?
SQL Data Compare
- Logging and log files
- Internal Connection Fatal Error in versions 4 and 5
- NULL textptr passed to UPDATETEXT function when running synchronization
- How much free hard disk space is required?
- Comparing the data of two tables in the same database
- Suggestions to combat comparison and synchronization performance issues
- SQL comparison and synchronization automation capabilities
- SqlNullValueException occurring in synchronization wizard
- SQL Data Compare command-line XML argument file examples
- Using Windows authentication logons between domains
- Using a filter on a column on related (joined) tables
- Determining minimum database permissions for SQL Data Compare
- Tables with compound keys may not be mapped automatically
- Best practices for synchronizing data
- Cleaning up a SQL script after SQL Compare or SQL Data Compare
- Troubleshooting System.OutOfMemoryException during comparison
- Exception thrown by db reader 1
- Reseed applying "incorrect" identity values
- Running migration scripts using SqlCmd.exe
- This SQL Server has been optimized for x concurrent queries.
- SQL Data Compare showing differences in 2 identical databases
- How to force SQL Compare and SQL Data Compare to use an Encrypted Connection
- Improving the performance of SQL Data Compare
- Logging and log files
- Case-sensitive comparisons
- Tables or views that could not be compared
all SQL products
- Compatibility of Red Gate tools in 64-bit environments
- Application has encountered an error and needs to close
- Error message after installing SQL Toolbelt - The description for Event ID ( 1 ) in Source ( nview_info ) cannot be found.
- Changing the temporary directory used by the installer
- Toolbelt Installer "hanging" while "scanning volumes"
- Login failing with "trusted SQL Server connection" error when using RunAs
all products
- Some Red Gate products identified as containing a trojan by Anti-Virus software
- Activation may fail with Unknown Error -1
- Product uses web help although a CHM file is available locally
- Argument exception resulting from missing environment variable
- Check for updates may fail when used through proxies
- 'Unidentified Publisher' error when repairing or uninstalling
- Licensing activates product as standard edition
- Moving Red Gate software products to another machine
- Red Gate tools log locations
- The application UI opening slowly when there is no internet access
SQL Data Compare
- Activating your products
- Activating your products
- Getting help offline
- Getting better performance out of SQL Data Compare
- Release notes - version 10.xx
- SQL Data Compare release notes - version 7.xx
- SQL Data Compare release notes - version 8xx
- SQL Data Compare release notes - version 9.xx
all SQL products
all products
- Red Gate product acknowledgements
- Activating your products
- Activating your products
- Red Gate bundle history
- Check for updates
- Troubleshooting Check for Updates errors
- Current versions
- Deactivating your products
- Installing Red Gate products from the .msi file
- Requesting additional activations
- Serial numbers for bundles
- Reactivating using a different serial number
- Extending your trial
- Finding your serial numbers
- Moving a serial number from one computer to another
- No response received for manual activation
- Licensing and activation resources
- Licensing and activation resources
- Troubleshooting licensing and activation errors
- Licensing and activation FAQs
- Red Gate tools log file locations
- Download old versions of products
- Download product prerequisites & utilities
- Support & upgrades
- Upgrading your software
- Upgrading FAQs

Using SQL Data Compare