From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Bruno Wolff III <bruno(at)wolff(dot)to> |
Cc: | Neil Conway <neilc(at)samurai(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Optimizing maximum/minimum queries (yet again) |
Date: | 2005-04-09 05:25:09 |
Message-ID: | 19604.1113024309@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Bruno Wolff III <bruno(at)wolff(dot)to> writes:
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> I don't have a problem with that, but I haven't quite convinced myself
>> that we need to expend the cycles to check for it, either ...
> I would expect that the sequential plan would be better for a volatile
> where clause since you are going to execute it for every row anyway.
Well, no, wait a minute. We have never promised that we would
physically evaluate every volatile function at every table row.
What we promise is that we do not assume-without-proof that the
function's value will be the same at every table row. I don't see
where this optimization breaks that promise.
Obviously, we do make such an assumption for WHERE clauses that actually
get taken into the indexscan condition. But we already check volatility
before considering a clause as a possible indexscan condition. The
question here is whether we have to reject the optimization if there are
additional WHERE clauses, not directly related to the proposed
indexscan, that contain volatile functions. I'm not seeing the argument
that says we must do that.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Bruno Wolff III | 2005-04-09 05:27:52 | Re: Optimizing maximum/minimum queries (yet again) |
Previous Message | Tom Lane | 2005-04-09 04:57:11 | Re: Optimizing maximum/minimum queries (yet again) |