Skip site navigation (1) Skip section navigation (2)

RE: [GENERAL] Long update query ? (also Re: [GENERAL] CNF vs. DNF)

From: "Taral" <taral(at)mail(dot)utexas(dot)edu>
To: "Bruce Momjian" <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: <pgsql-general(at)postgreSQL(dot)org>
Subject: RE: [GENERAL] Long update query ? (also Re: [GENERAL] CNF vs. DNF)
Date: 1998-10-02 05:35:12
Message-ID: 000001bdedc6$6cf75d20$3b291f0a@taral (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-hackers
> It currently convert to CNF so it can select the most restrictive
> restriction and join, and use those first.  However, the CNF conversion
> is a memory exploder for some queries, and we certainly need to have
> another method to split up those queries into UNIONS.  I think we need
> to code to identify those queries capable of being converted to UNIONS,
> and do that before the query gets to the CNF section.  That would be
> great, and David Hartwig has implemented a limited capability of doing
> this, but we really need a general routine to do this with 100%
> reliability.

Well, if you're talking about a routine to generate a heuristic for CNF vs.
DNF, it is possible to precalculate the query sizes for CNF and DNF
rewrites...

For conversion to CNF:

At every node:

if nodeType = AND then f(node) = f(left) + f(right)
if nodeType = OR then f(node) = f(left) * f(right)

f(root) = a reasonably (but not wonderful) metric

For DNF just switch AND and OR in the above. You may want to compute both
metrics and compare... take the smaller one and use that path.

How to deal with other operators depends on their implementation...

Taral


In response to

Responses

pgsql-hackers by date

Next:From: Bruce MomjianDate: 1998-10-02 06:02:48
Subject: Re: [GENERAL] Long update query ? (also Re: [GENERAL] CNF vs. DNF)
Previous:From: Bruce MomjianDate: 1998-10-02 05:34:36
Subject: Re: [HACKERS] Names that suddenly include an OID

pgsql-general by date

Next:From: Bruce MomjianDate: 1998-10-02 06:02:48
Subject: Re: [GENERAL] Long update query ? (also Re: [GENERAL] CNF vs. DNF)
Previous:From: Bruce MomjianDate: 1998-10-02 02:18:29
Subject: Re: [GENERAL] Long update query ? (also Re: [GENERAL] CNF vs. DNF)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group