Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replicators: Use a row estimate for snapshotting progress
Especially for very large tables, doing a full count of the number of rows using `COUNT(*)` can be quite expensive - we've seen issues in real-world deployment scenarios where this has taken quite a long time (long enough that we didn't wait to let it finish, instead opting to just kill the query backend). A much faster, albeit less accurate way of *estimating* the number of rows in the table is to just look at the `reltuples` column in the `pg_class` entry for the table. Since we're only using this to report snapshotting progress, we don't need a 100%-guaranteed-accurate count of the rows, so this should be perfectly fine to do here, and save a lot of time and load on the upstream db during snapshotting. Fixes: ENG-2827 Change-Id: I72ee9e5f54597e30d83f2f9221163237086c600a Reviewed-on: https://gerrit.readyset.name/c/readyset/+/4873 Tested-by: Buildkite CI Reviewed-by: Dan Wilbanks <dan@readyset.io>
- Loading branch information