Source Postgres : Use fast select to get table size estimate in Postgres #21499
Labels
needs-triage
team/db-dw-sources
Backlog for Database and Data Warehouse Sources team
type/enhancement
New feature or request
While calculating the estimated rows to be synced for Source Postgres connector the
count()
operation is currently used. However, this is not optimal as :There is a faster way to get a very rough estimate :
select reltuples::int8 as count from pg_class c JOIN pg_catalog.pg_namespace n ON n.oid=c.relnamespace where nspname='20m_users' AND relname='users';
However, the issue is that this is wildly incorrect (have seen it return -1) for smaller tables. We'd like to try the fast query and fall back to the slow count if it is negative.
See discussion : #20783
The text was updated successfully, but these errors were encountered: