Re: unnesesary sorting after Merge Full Join

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: unnesesary sorting after Merge Full Join
Дата
Msg-id 4458.1204046323@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: unnesesary sorting after Merge Full Join  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: unnesesary sorting after Merge Full Join
Список pgsql-general
I wrote:
> Gregory Stark <stark@enterprisedb.com> writes:
>> as a path key, though we would have to create an equivalence class
>> and add COALESCE(id2,id1) to it as well I think.

> No, because those two expressions are not equivalent.  (Hmm ... squint
> ... but full merge join is pretty much symmetric, so it's not clear
> why it should matter which side is left or right.  Maybe COALESCE isn't
> exactly the right concept with which to describe the merged variable?)

Wait ... after consuming more caffeine, I think you were right.  The
point of an EquivalenceClass is that it asserts the contained
expressions must have the same values, and in the case of a full join
it actually is the case that COALESCE(id1,id2) = COALESCE(id2,id1)
at every output row.  So it's legitimate to put both expressions in
the same eclass, even though their values might be different in other
circumstances.  And that solves our symmetry problem because the eclass
is the same whichever way you build it.

It might still be interesting sometime to have a more bespoke
representation for a merged variable, but I guess we don't need
it just for this.

            regards, tom lane

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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: how to auto GRANT custom ACL on a new table?
Следующее
От: Gregory Stark
Дата:
Сообщение: Re: Query meltdown: caching results