Re: [HACKERS] Case statement ready? - Mailing list pgsql-hackers

From Thomas G. Lockhart
Subject Re: [HACKERS] Case statement ready?
Date
Msg-id 3668CC28.30C5349C@alumni.caltech.edu
Whole thread Raw
In response to Re: [HACKERS] Case statement ready?  (Bruce Momjian <maillist@candle.pha.pa.us>)
List pgsql-hackers
> > For the costing I would assume
> > that the cost should be related to the sum of the costs of the
> > individual clauses within the CASE statement (or maybe half of the 
> > sum).
> Isn't only one of the case values going to be used?  Wouldn't you want
> the average of the case entry costs?

Hmm. Actually, on average half of the conditional clauses will be
evaluated, and then one of the result clauses will be evaluated. So
perhaps the cost should be:
 (0.5*sum(conditional clauses))+avg(result clauses)

Or perhaps we should be pessimistic and leave off the 0.5.
               - Tom


pgsql-hackers by date:

Previous
From: jwieck@debis.com (Jan Wieck)
Date:
Subject: Re: [HACKERS] Case statement ready?
Next
From: "Thomas G. Lockhart"
Date:
Subject: Re: [HACKERS] Case statement ready?