Rust PGDataDiff
rust-pgdatadiff
is a re-write of the Python version of pgdatadiff
What makes it different?
-
It is schema aware right from the get-go, as when we had to use the original
pgdatadiff
we ended up having different schemas that we needed to perform checks on. -
It runs DB operations in a parallel fashion, making it at least 3x faster in comparison to the original
pgdatadiff
which performs the checks sequentially.
Installation
cargo install rust-pgdatadiff
Examples
You can spin up two databases already prefilled with data through Docker Compose.
docker compose up --build
Prefilled databases include a considerable amount of data + rows so you can run benchmarks against them to check the performance of it. You can modify a few of the generated data in order to see it in action.
You can find an example of using it as a library in the examples
directory.
Run the example with the following command, after Docker Compose has started:
cargo run --example example_diff diff \
"postgresql://localhost:5438?dbname=example&user=postgres&password=postgres" \
"postgresql://localhost:5439?dbname=example&user=postgres&password=postgres"
You can also enable Rust related logs by exporting the following:
export RUST_LOG=rust_pgdatadiff=info
Switching from info
to debug
will give you more detailed logs. Also since we are utilizing
sqlx
under the hood, you can enable sqlx
logs by exporting the following:
export RUST_LOG=rust_pgdatadiff=info,sqlx=debug