On Mon, Feb 3, 2025 at 6:19 PM Dmitry Koterov <dmitry.koterov@gmail.com> wrote:
>
> What's also suspicious is that on the destination node, after copying finishes,
>
> # explain select 1 from mytable;
> Seq Scan on mytable (cost=0.00..6821514.12 rows=250410012 width=4)
>
> # SELECT relname, n_live_tup FROM pg_stat_user_tables WHERE relname = 'mytable';
> relname | estimated_rows
> -------------+----------------
> mytable | 150342468
>
> Notice the discrepancy between how many rows EXPLAIN thinks there is in the table, and how many rows
pg_stat_user_tablesthinks about it (250M vs. 150M).
>
Is it possible that analyze has not yet run on the table on
subscribers? Can you try running the Analyze command on the subscriber
before trying the above two statements?
--
With Regards,
Amit Kapila.