Hi, On Fri, Jan 18, 2019 at 02:12:23PM +0000, Luis Carril wrote: > we noticed that in the presence of a schema with many partitions the jitting overhead penalizes the total query execution time so much that the planner should have decided not to jit at all. For example without jitting we go a 8.3 s execution time and with jitting enabled 13.8 s. ... > Is this behavior expected? Is the cost function for jitting missing some circumstances? On Fri, Jan 18, 2019 at 08:42:54AM -0800, Andres Freund wrote: > The costing doesn't take the effect of overhead of repeated JITing in > each worker into account. I could give you a test patch that does, if > you want to play around with it? On Fri, Jan 18, 2019 at 06:02:43PM +0000, Luis Carril wrote: > yes please it would be much apreciated. I'm also interested to try that ; on re-enabling JIT in 11.2, I see that JITed queries seem to be universally slower than non-JIT. I found that was discussed here: https://www.postgresql.org/message-id/20180822161241.je6nghzjsktbb57b%40alap3.anarazel.de https://www.postgresql.org/message-id/20180624203633.uxirvmigzdhcyjsd%40alap3.anarazel.de Multiplying JIT cost by nworkers seems like an obvious thing to try, but I wondered whether it's really correct? Certainly repeated JITing takes N times more CPU time, but doesn't make the query slower...unless the CPU resources are starved and limiting ? Justin