In a system that separates commands from queries, a successful operation is only the start. A command was accepted, an event was published, a projector ran, and the read side should now show the result. Whether it actually does is a question about data, and it is usually answered by hand, with two queries and a spreadsheet.
dbSlice can make that check repeatable. It compares two tables by key and, optionally, by the values of selected columns. It reports what is missing on each side and which rows differ, and it saves the keys so the investigation can continue. It works on the data as it is when it reads it: your team decides what to compare, which window to use, and what counts as correct.
This guide follows the Synchronize tab in dbSlice 2.3, where the Record Diff and Compare buttons live, the Data view tab, and the Replicator tab, which copies several tables in one run. It explains how to apply them to a write database and a read database, how to read the result, and where the check stops. Availability can vary by license.
1. The questions after a successful operation
"The command returned success" does not say that the read model is right. These are the questions that remain.
| Question | What the comparison shows |
|---|---|
| Did the expected IDs arrive? | Keys present on both sides are counted as matching. |
| Are records missing? | Keys that exist on one side and not on the other are listed as Missing in destination or Missing in source. |
| Do the selected field values match the intended mapping? | With Also compare column values, rows that share a key but differ in a value are listed under Rows with different values, column by column. |
| Is a difference projection lag, an intentional transformation, or a defect? | The tool shows the difference. Deciding what it means is a review step, described in section 8. |
2. Where dbSlice fits
dbSlice is not part of the command path or of the projection path. It sits beside them and reads. It can be pointed at the write database, at the read database, or at both.

| Use | What you do |
|---|---|
| Support one database on its own | Inspect the write database or the read database independently: browse rows in Data view, export a selected set, or generate a list of keys. |
| Reconcile both | Point Source at one database and Target at the other, and let dbSlice match keys and compare the selected columns. |
| Prepare and recover | Support initial loads and controlled refreshes of a read database, and investigate the gaps found before a controlled rerun. |
3. Define the scope first
A comparison is only as meaningful as the question behind it. Before opening the tab, settle four things with the team that owns the application.
- The pair of tables. One run compares one table or query on the source side with one table on the target side. A read model built from several tables needs a comparable query, covered in section 9.
- The key. The comparison needs a unique key column on each side. The two sides may name it differently; the target key is chosen on its own.
- The columns that matter. Decide which fields must match, and which are expected to differ because the projection transforms them. Column mapping lets you compare only the mapped columns.
- The window. Writes and projections do not happen at the same instant. Choose a period in which the read side should have caught up, and compare rows from that period. Section 9 explains how to limit the rows read.
The scope, the reference data, and the validation criteria belong to your team. dbSlice applies them consistently; it does not infer them.
4. Inspect one side on its own
Not every question needs two databases. If a record is suspected to be wrong on the write side or the read side, look at that side first.
The Data view tab is a read-only grid of the source, with previous and next paging and a row counter. You can copy the selected rows, export the visible page to CSV, and open one record field by field. It does not change data.
To carry a selection somewhere else, the Export tab includes two outputs made for this: SQL — key IN (…) and CSV — key list. They write the keys of the rows you selected, so they can be pasted into a query or handed to another team.
5. Reconcile the write side and the read side
Reconciliation runs from the Synchronize tab. The same fields that configure a copy configure the comparison, and the comparison itself reads only.

| Control | Purpose in a reconciliation |
|---|---|
| Source: connection, source type, object, key column | One side of the comparison. The source type can be a table, a view, or a SELECT. The key column must be unique. |
| Target: connection, table, key column | The other side. Its key column can have a different name. |
| Map columns... | Which source columns correspond to which target columns. Automatic by name unless you map them. |
| WHERE filter | Restricts the rows read from the source. It is not applied to the target, as explained in section 9. |
| Also compare column values | Adds a value comparison for the mapped columns, on top of the key comparison. |
| Record Diff | Key-only check, read-only. |
| Compare | Reconciliation, read-only. With Also compare column values, it also reports differing values. |
| Execution log | Counts, the first differing keys, and the result of the run. |
Neither Record Diff nor Compare writes to either database. Run synchronization is the button that does, and it is not needed to reconcile.
Which database is the source and which is the target is your choice. The labels in the log follow that choice: a key found only in the source is reported as missing in the destination, and a key found only in the target is reported as missing in the source. Choose the direction that matches the question, for example "write side as source" to ask what has not reached the read side.
6. Record Diff: the fast key check
Record Diff reads only the key column on both sides. It is the quick check to run first, because it needs little data from either database.
The log reports the number of rows on each side, the keys that exist only in the source, the keys that exist only in the target, and the total number of records that differ. When the source is a table or a view, the log also prints a ready SELECT … WHERE key IN (…) with the first missing keys, so the rows can be inspected in the origin right away.
Record Diff says nothing about values. Two rows with the same key and different content are, for Record Diff, a match.
7. Compare: keys and field values
Compare runs the same key reconciliation. With Also compare column values selected, it also checks the mapped columns.
To do that, dbSlice reads the target once and keeps, for each key, a compact fingerprint of the values in the compared columns. It then reads the source and compares each row's fingerprint with the one held for the same key. For a sample of the rows that differ, it reads the actual values again and lists them column by column in the log, in the form key: column [source value ≠ target value].
How values are compared
The two databases may store the same value in different types. To avoid reporting differences that are only about representation, values are normalized before they are compared.
| Kind of value | How it is compared |
|---|---|
| Text | Spaces at the start and end are ignored. The comparison is exact otherwise, so a and A are different. |
| Numbers | Converted to the same decimal form regardless of type, so 10 and 10.00 are equal. |
| Booleans | Compared as 1 and 0. |
| Dates and times | Compared in a full round-trip format. A value stored with less precision on one side can show as a difference. |
| NULL | NULL equals NULL. NULL and an empty string are different values. |
For a column that the read model deliberately transforms, compare against the value you expect after the transformation, not against the original. A raw comparison will report a difference there, and that is correct: it is the transformation. Keep intentional differences separate from missing records and from unexpected mapping changes.
8. Read the result
The result has three categories. What each one suggests depends on the system, so treat the right-hand column as a list of places to look, not as a diagnosis.
| Category | Meaning | Places to look |
|---|---|---|
| Match | The key exists on both sides and, if values were compared, the selected values are equal. | Nothing to do for the compared columns. Columns that were not compared are not covered. |
| Missing | The key exists on one side only. | Projection lag; an event that was not published or not consumed; a projector failure; a delete that did not propagate; a filter that excludes the row on one side. |
| Mismatch | The key exists on both sides, and a selected value differs. | An intentional transformation; a mapping that changed; a projector that applied an older event; a column populated from a different source. |
Lag is the most common reason for a gap and the easiest to rule out: run the comparison again later. A key that was missing and has arrived was lag. A key that stays missing needs investigation. Running twice and comparing the two results is a simple way to tell moving differences from stable ones.
9. Projections that transform or aggregate
A read model is not always a copy of one table. It may join, flatten, or total data from several tables. A direct table-to-table comparison does not apply there, and the comparison has to be defined.
- Use a query on the source side. Set the source type to SELECT and write a query that returns the same grain as the read table: one row per key, with the columns you want to compare. The key column must be in the query's result.
- Name the target table. When the source is a SELECT, the target table is required. Column mapping by hand is not available for a SELECT; columns are matched by name, so give the query's columns the names used by the target.
- Compare like with like. If the read side holds a total, compute the same total in the query, with the same rule for rounding, status, and period.
- Fix the verification window. The WHERE filter, or a condition inside the query, limits the rows read from the source. The whole target table is read. Rows of the target that fall outside the window will therefore appear as missing in the source. Use a target table or view that holds only the same window when you need a strict result, or ignore that category deliberately.
Your application keeps owning the business rules. dbSlice compares the two result sets; it does not know why a total should be what it is.
10. Keep the list of differing keys
At the end of a Record Diff or a Compare that found differences, dbSlice offers to save the keys. The file is a text file with one section per category: missing in destination, missing in source, and rows with different values. Within each section the IDs are separated by a comma and a space, ready to be pasted into a WHERE key IN (…).
The log and the file hold a sample, not an unlimited list: up to 1,000 keys per category. When a category has more, the file states the real total next to the number of keys listed. The counts in the log are always complete.
Use the list to look at the same rows in both databases, to hand a precise set to the team that owns the projector, or to run a controlled correction for exactly those keys, as described in section 11.
11. Replicate: build or refresh a read database
The Replicator tab has its own guide: Replicate several tables in one run.
Comparing is half of the job. When the comparison shows that a read database is empty, stale, or missing a set of keys, dbSlice can also write. The Replicator tab, next to Synchronize, copies a list of tables from one connection to another in a single run. Where Synchronize works on one table at a time, the Replicator takes the tables you tick.
The Replicator tab

| Control | Purpose |
|---|---|
| Source and Target connections | The database to read from and the database to write to. Click Connect on both; the tables of each are then loaded. |
| Mode | What a run may do to each target table. It is chosen once for all the tables in the run. |
| Page (rows) | How many rows are read and written at a time. |
| Create table on target if missing (migration) | Creates a target table that does not exist yet, translating the column types between the two engines. |
| Keep source IDENTITY (SQL Server) | Keeps the identity values of a SQL Server source instead of letting the target generate new ones. On SQL Server, when the target has an IDENTITY column, Upsert and New rows only stop before writing anything and explain what your DBA needs to do: SQL Server only accepts the source key with the identity turned off, and dbSlice does not change your database settings. Keep source IDENTITY (Initial load and Full load) needs ALTER permission on the target table; without it, dbSlice says so instead of SQL Server's misleading 'object not found' message. |
| Don't count rows before starting (very large tables) | Skips the initial count, which saves time on very large tables. |
| Tables to replicate | One row per table: source table, source key, target table, target key, and the result of the last run. A checkbox selects the row; Select all, Clear selection, and Remove from list manage the list, and a counter shows how many are selected. |
| Run synchronization, Record Diff | Run the replication of the ticked tables, or run the key check. |
| Cancel (Processing status panel) | Stops a run in progress. |
| Load and Save | Keep a configuration and reopen it later. |
| Execution log | The tables loaded, then for each table the rows read, inserted, and updated, with the time split into read, transform, and write, and a final count of tables that finished. |
Tables with the same name on both sides are paired automatically. Where the names differ, adjust the target table and the key in the row, tick it, and run. After a run, the Result column shows the outcome of each table, for example 0 inserted, 120 updated, and the log ends with a summary such as Replication finished: 2 ok, 0 failed, 0 not run.
How a run behaves
- Order. The ticked tables run one at a time, in the order of the list. The arrows move a table up or down, and Suggest order proposes parents before children, using the foreign keys of the target, and the smallest tables first among those that can go.
- A failed table. It does not stop the others. The run continues, and the failure is shown in the Result column and in the log.
- Cancel. It stops the run at the current point. The tables that had not started are reported as not run.
- Confirmations. Full load lists up to ten tables that will be emptied. Writing to a read-only profile, or between different environments, also asks first.
- Full load empties all ticked tables first. It does so children before parents, without CASCADE, and refuses before deleting when a table outside the list refers to the list, a child comes before its parent, a target table is missing, or the foreign keys cannot be read. The tables are empty until the load ends, so use a maintenance window. The Replicator guide has the details.
- Identifiers. After writing rows with the source ids, dbSlice advances the table's id generator to the largest id written — PostgreSQL sequences, Firebird 3+ and Oracle 12c+ identity columns — only forward, so the next insert in your system does not repeat an id. If it cannot (for example, missing permission), the rows stay written and the log tells you that your DBA needs to advance the generator. A generator driven by a trigger (Firebird 2.5 style) is not adjusted.
- What is not per table. There is no WHERE filter, column mapping, or masking in this tab, and the source is a table, not a query. Use the Synchronize tab when one table needs them.
- No resume per table. A large table that was interrupted is resumed in the Synchronize tab.
- Record Diff. The same key-only check as in Synchronize, for each ticked table. It does not compare values.
- Saved configuration and command line. Save writes a
*_replicator.jsonfile, and a job of typereplicateruns it without the screen.
When to use it
- The first load. The read database is new, or new read tables were added, and they need the existing history.
- A controlled refresh. A projection was changed and several tables have to be rebuilt from the write side.
- A read database on another engine. The write side runs on one database and the read side on another, for example SQL Server writing and PostgreSQL reading. dbSlice translates the types between the two.
- A read model in a NoSQL system. MongoDB, Cassandra, Elasticsearch, Couchbase, and Redis can be the target, as described in the Replicator guide. Record Diff and Compare do not work with a NoSQL target yet.
- A targeted correction. For a set of keys found by Compare, use the Synchronize tab: its WHERE filter limits the run to those keys.
Choose the mode
The mode decides what a run is allowed to do to the target. The Synchronize tab lists these modes and states the impact of the selected one before the run. The Replicator tab in the figure uses Upsert.
| Mode | What it does to the target | Use it for |
|---|---|---|
| Upsert — insert new and update existing | Inserts missing keys and updates rows that changed. Does not delete. | Refresh and targeted corrections. |
| New rows only (skip existing keys) | Inserts only keys that are not in the target. Existing rows are not touched. | Filling gaps without changing what is already there. |
| Update existing only (UPDATE) | Updates rows whose key exists. No inserts, no deletes. | Correcting values on rows that arrived. |
| Initial load (INSERT into empty table) | Inserts every row and fails if a key already exists. | The first load of an empty read table. |
| Full load (TRUNCATE + INSERT) | Deletes every row in the target and reloads it from the source. | Rebuilding a read table from scratch. Use with care. |
Only the last mode removes rows. In the others, a row that exists only in the target stays there, and a later Compare still reports it as missing in the source. Deletes that happened on the write side are not carried over by these modes, so they need their own decision.
Make the rerun controlled
- Tick only the tables you need. The counter shows how many are selected before the run.
- Choose the narrowest mode. New rows only for a gap, update existing only for a value.
- Confirm the target. Check that the Target connection is the read database and not the write database. A rerun writes to it.
- Verify afterwards. Run Record Diff or Compare again on the same scope and confirm that the differences are gone.
A run starts when you start it. dbSlice is not a continuous replication service and does not follow the write database's log. Keeping a read side up to date between runs remains the work of the application's projections.
12. Prepare, verify, recover
| Stage | How dbSlice supports it |
|---|---|
| Prepare | Initial loads and controlled refreshes of a read database, as described in section 11, with a saved configuration in the Replicator tab. See also the guide on controlled data movement. |
| Verify | Keys, records, and selected field values, with Record Diff and Compare as described above. |
| Recover | Investigate the gaps first. When a controlled rerun is the right answer, restrict it to the keys from the saved list and review the result with Compare again. |
A rerun writes to the target. If the target is a read model fed by projectors, copying rows into it bypasses the projection and may hide the reason the gap appeared. Decide with the team whether the right recovery is to replay the event path in the application or to refresh the rows directly.
13. Run it from the command line
The same read-only check can run without the screen. A saved job of type Status compares the source and the target, including column values, and reports the counts of matching, missing, and differing rows in its result. It is the form to use when the verification is repeated, for example after each projection refresh, and the result needs to be kept with the other job reports.
14. Send Data: confirmed, rejected, and unknown
Some write-side flows deliver data to another system rather than to a database. For those, the Send Data tab keeps three outcomes apart: confirmed, rejected, and unknown. See the Send Data guide.
An acknowledgement from the destination means that the destination answered. It does not establish that every downstream business operation completed. A reconciliation of the destination's own data remains the check for that.
15. What this check does not do
- It reads a moment, not a stream. The result describes the data when it was read. Rows written during a long run may be counted on one side only. Choose a quiet window or a stable period, and repeat the run to confirm.
- It does not know projection lag. A difference caused by lag is reported like any other difference.
- It does not check a NoSQL read model. NoSQL systems are destinations only, and Record Diff and Compare do not work with them yet.
- It compares one table or query pair per run. A whole read model needs several runs.
- The target is read in full. The WHERE filter applies to the source. The key set, or the fingerprints of the compared columns, are held in memory while the run lasts, so very large targets need a machine with enough memory.
- It needs a unique key on both sides. Without one, rows cannot be matched.
- Equal fingerprints are treated as equal values. The value comparison is built for speed on large tables; the listed differences always show the actual values.
- It does not apply your business rules. A rule that a closed order must have a closing date, or that a total is net of discounts, belongs to the application. Encode it in the query you compare.
- It does not repair. Record Diff and Compare only read. Any correction is a separate, deliberate run, as described in section 11.
A careful first reconciliation
- Choose one table and write down the question: which keys, which columns, which period.
- Confirm that both sides have a unique key, and decide which database is the source.
- Connect to both databases with accounts that can read, not write.
- Set the WHERE filter, or the SELECT, to the verification window.
- Run Record Diff first and read the counts.
- Map the columns and select Also compare column values.
- Run Compare and read the sample of differing rows.
- Save the list of differing keys.
- Run again after a short interval and compare the two results, to separate lag from stable gaps.
- Take the stable differences to the owners of the write path and the projection before deciding on a rerun.
Scope of this guide
The controls and log lines described here were taken from a screenshot of the Synchronize tab in dbSlice 2.3 and from the implementation of Record Diff, Compare, the saved list of differing keys, the synchronization modes, and the job of type Status in the command-line mode. The behavior of the Replicator tab, including the order of the tables, a failed table, and a cancelled run, is described in its own guide and was confirmed against the application implementation.
No CQRS system was reconciled to write this article, and no speed or capacity figure is claimed. The table in the figure is illustrative and the screenshot uses synthetic documentation tables. The causes listed in section 8 are places to look, not a diagnosis of any specific system.