Filtering data overview
The Red Gate Data Comparison API contains a number of ways to filter data both horizontally (rows) and vertically (columns). The strategy to use depends on the level at which you want to filter:
- Horizontally, at the SQL Server (WHERE clauses)
- Horizontally, in the comparison results (ColumnConstraint)
- Horizontally, when creating synchronization scripts (SelectionDelegate)
- Vertically, at the SQL Server (FieldMappings, TableMappings)
Vertically, in the comparison results (Fields.Remove)Currently broken, a bug has been logged
- Vertically, when creating synchronization scripts (FieldMapping.Remove)
Filtering at the SQL Server level has the advantage of excluding records from being compared, saving memory and disk space and speeding up the comparison. The disadvantage is that you cannot include the filtered data without starting the comparison over.
Filtering the results is mainly for limiting the data that the user can see. There are no savings in terms of disk space or memory. Typically, the user of your application would initiate this filter when viewing sets of comparison results to narrow-down the information being displayed. If a synchronization script is generated while the filter is in place, the filtered rows and columns are omitted from the script also.
You would filter at the synchronization script level if you want the user to see all of the comparison results, but only synchronize a subset of the data.