Re: Hash Right join and seq scan

Justin Pryzby <pryzby@telsasoft.com>

From: Justin Pryzby <pryzby@telsasoft.com>
To: James Pang <jamespang886@gmail.com>
Cc: Tomas Vondra <tomas.vondra@enterprisedb.com>, David Rowley <dgrowleyml@gmail.com>, pgsql-performance@lists.postgresql.org
Date: 2024-07-08T02:26:56Z
Lists: pgsql-performance
Is the query fast with some bind parameters but slow with others?

If so, it'd be better to show an explain with 'fast' and 'slow' bind
params, rather than the same bind params with enable_*=off.

Or is the change because autoanalyze runs on some table and changes the
statistics enough to change the plan ?  Investigate by setting
log_autovacuum_min_duration=0 or by checking
pg_stat_all_tables.last_{auto,}{vacuum,analyze}.

Maybe your llid/hhid are correlated, and you should CREATE STATISTICS.

Or maybe the answer will be to increase the stats target.