On Wed, Apr 02, 2025 at 10:34:58PM -0400, Corey Huinker wrote: >> >> > Also, why do we need the clause "WHERE s.tablename = ANY($2)"? Isn't >> > that already implied by "JOIN unnest($1, $2) ... s.tablename = >> > u.tablename"? >> >> Good question. Corey, do you recall why this was needed? >> > > In my patch, that SQL statement came with the comment: > > + /* > + * The results must be in the order of relations supplied in the > + * parameters to ensure that they are in sync with a walk of the TOC. > + * > + * The redundant (and incomplete) filter clause on s.tablename = ANY(...) > + * is a way to lead the query into using the index > + * pg_class_relname_nsp_index which in turn allows the planner to avoid an > + * expensive full scan of pg_stats. > + * > + * We may need to adjust this query for versions that are not so easily > + * led. > + */
Thanks. I included that in the latest patch set. -- nathan