Re: Reducing expression evaluation overhead
От | Tom Lane |
---|---|
Тема | Re: Reducing expression evaluation overhead |
Дата | |
Msg-id | 12971.1079412472@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Reducing expression evaluation overhead (Sailesh Krishnamurthy <sailesh@cs.berkeley.edu>) |
Список | pgsql-hackers |
Sailesh Krishnamurthy <sailesh@cs.berkeley.edu> writes: > I like the idea of memoizing the switch with function pointers as I > don't think branch prediction helps much with varying switch arms > selected with different exprs. Check, it's hard to see how any CPU could get much traction on the behavior of the switch jump in ExecEvalExpr. > I've forgotten the syntax of case, but for the simple form isn't > expr=const going to be the same expr for each case arm ? If that's the > case, couldn't we actually save the value of expr in a Datum and then > reuse that (through a Const) in each of the other arms to evaluate the > actual exprs ? That should reduce the number of times ExecEvalVar (and > through it heapgetattr) are called. Right now we expand the simple form of CASE into the general form:CASE x WHEN y THEN ... WHEN z THEN ... becomesCASE WHEN x=y THEN ... WHEN x=z THEN ... This does involve multiple evaluation of x, which'd be particularly nasty if it's more than just a variable reference. It's probably a good idea to try to improve that. But inlining ExecEvalExpr will help all expressions not just CASE, so I'll work on that first ... regards, tom lane
В списке pgsql-hackers по дате отправления: