Re: Canonicalization of WHERE clauses considered harmful

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Canonicalization of WHERE clauses considered harmful
Дата
Msg-id 8814.1071094462@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Canonicalization of WHERE clauses considered harmful  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-hackers
Bruno Wolff III <bruno@wolff.to> writes:
> Shouldn't it be possible to simplify
> a AND (a OR c) AND (b OR a) AND (b OR c)
> to
> a AND (b or c)
> using
> a AND (a OR x) == a

That would be one possible response, but it strikes me as a band-aid fix.
It would add quite a bit of overhead (looking to see if any OR
subclauses match any top-level clauses) on top of the rather expensive
equality checks qual_cleanup() is already making.  Another problem is
that sometimes prepqual decides not to attempt CNF-ification at all,
which means that the ability to pull out duplicate subclauses is lost
altogether.

I think it'd be cleaner to expend the cycles on a direct check for
duplicate subclauses, which we could apply independently of any decision
to convert what remains to CNF form.

We've had lots of problems with prepqual before, which is why those
heuristics about whether to try for CNF or DNF are in there; but I've
never been very happy about them.  What I'm on about now is the idea
that maybe the whole problem should be thrown overboard ...
        regards, tom lane


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

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: Canonicalization of WHERE clauses considered harmful
Следующее
От: Kurt Roeckx
Дата:
Сообщение: Re: Canonicalization of WHERE clauses considered harmful