2000-01-28:在WHERE子句中适当地使用DNF而不是CNF

25 年前的今天(PostgreSQL 7.0 开发周期),进行了一项更改,使得在适当的情况下可以使用 DNF(“析取范式”)而不是 CNF(“合取范式”)。

commit 003dd965d2380823624f58d0d0cf72c4edc3bcb4
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date:   Fri Jan 28 03:22:36 2000 +0000

    Apply the heuristic proposed by Taral (see pgsql-general archives for
    2-Oct-98 or TODO.detail/cnfify) to decide whether we want to reduce
    WHERE clause to CNF form, DNF form, or neither.  This is a HUGE win.
    The heuristic conditions could probably still use a little tweaking to
    make sure we don't pick CNF when DNF would be better, or vice versa,
    but the risk of exponential explosion in cnfify() is gone.  I was able
    to run ten-thousand-AND-subclause queries through the planner in a
    reasonable amount of time.

从实际角度来看,这意味着可以更有效地处理更多的 AND / OR 子句,并避免了在 DNF 更有效的情况下使用 CNF 可能导致的内存不足错误。

相关的邮件列表