Re: Optimizing maximum/minimum queries (yet again)
От | Tom Lane |
---|---|
Тема | Re: Optimizing maximum/minimum queries (yet again) |
Дата | |
Msg-id | 19604.1113024309@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Optimizing maximum/minimum queries (yet again) (Bruno Wolff III <bruno@wolff.to>) |
Список | pgsql-hackers |
Bruno Wolff III <bruno@wolff.to> writes: > Tom Lane <tgl@sss.pgh.pa.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
В списке pgsql-hackers по дате отправления: