Re: New design for FK-based join selectivity estimation

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: New design for FK-based join selectivity estimation
Дата
Msg-id 25469.1465138626@sss.pgh.pa.us
обсуждение исходный текст
Ответ на New design for FK-based join selectivity estimation  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: New design for FK-based join selectivity estimation  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Список pgsql-hackers
I wrote:
> ... Here is a sketch of what I think is a better way:
> ...
> It's possible that we could reduce the cost of matching non-EC join
> quals as well, with some trick along the line of pre-matching non-EC
> RestrictInfos to FK items.  I'm unsure that that is worth the trouble
> though.

After further thought, I believe that may well be worth doing.  That
is, someplace after deconstruct_jointree(), examine all the FKs and
match their columns not only to ECs but to non-EC joinclauses, which
we could find by trawling the joininfo list for either subject relation.
We'd end up with a EC pointer and/or a list of non-EC RestrictInfos
for each FK column.

The thing that makes this attractive is that at the end of this matching,
we would know exactly whether each FK is matched to the query as a whole:
either all its columns have matches, or they don't.  It's not necessary to
re-determine that for each joinrel pair that includes the FK's two subject
relations.  So the per-join-relation work would reduce to scanning the FK
list once to find the matched FK(s) that connect relations on opposite
sides of the join.  Once we've found such an FK, identifying which join
qual list items should be dropped in favor of applying the FK's
selectivity is also really easy: we just check the column markings.
        regards, tom lane



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [sqlsmith] Failed assertion in joinrels.c
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: Parallel query and temp_file_limit