Re: Bad estimate with partial index

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Bad estimate with partial index
Дата
Msg-id 2943313.1650481405@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Bad estimate with partial index  (Tomas Vondra <tomas.vondra@enterprisedb.com>)
Список pgsql-hackers
Tomas Vondra <tomas.vondra@enterprisedb.com> writes:
> But dependencies.c might need a fix too, although the issue is somewhat
> inverse to this one, because it looks like this:

>     if (IsA(clause, RestrictInfo))
>     {
>         ... do some checks ...
>     }

> so if there's no RestrictInfo on top, we just accept the clause. I guess
> this should do the same thing with checking relids like the fix, but
> I've been unable to construct an example demonstrating the issue (it'd
> have to be either pseudoconstant or reference multiple rels, which seems
> hard to get in btcostestimate).

Hm.  You could get an indexqual referencing other rels when considering
doing a join via a nestloop with parameterized inner indexscan.  However,
that would always be a query WHERE clause, which'd have a RestrictInfo.
At least in this code path, a bare clause would have to be a partial
index's predicate, which could not reference any other rels.  The
pseudoconstant case would require a predicate reducing to WHERE FALSE
or WHERE TRUE, which is at best pointless, though I'm not sure that
we prevent it.

You might have to go looking for other code paths that can pass a
bare clause if you want a test case for this.

            regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: preserving db/ts/relfilenode OIDs across pg_upgrade (was Re: storing an explicit nonce)
Следующее
От: Thomas Munro
Дата:
Сообщение: Re: pg14 psql broke \d datname.nspname.relname