Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fsYBe-0007GG-CA for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Aug 2018 18:48:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fsYBb-0003Xk-NK for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Aug 2018 18:48:55 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fsYBb-0003Xc-9r for pgsql-hackers@lists.postgresql.org; Wed, 22 Aug 2018 18:48:55 +0000 Received: from host.pinaraf.info ([37.187.77.179] helo=mx2.pinaraf.info) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fsYBX-0000FK-P9 for pgsql-hackers@lists.postgresql.org; Wed, 22 Aug 2018 18:48:54 +0000 Received: from pierred-pdoc.localnet (LFbn-1-5277-196.w90-105.abo.wanadoo.fr [90.105.239.196]) by mx2.pinaraf.info (Postfix) with ESMTPSA id 41wc5F0v8XzV8BH for ; Wed, 22 Aug 2018 20:48:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=pinaraf.info; s=mx2; t=1534963729; bh=wxqs/KrkeWEuKIt2aESRox2pZ1Yw/X0UbLywHLdsN1U=; h=From:To:Subject:Date:In-Reply-To:References:From; b=eFPNdp7RWAVulXnMkrSA2vpxsxchPxzJlRrMTEgUBkEEnpzuFDd1ePYAutBG3n4y3 zki7G3RcEG3CAVl8PWaXdM5j5HwzUuMmgh0OqSn5DgGKKMCNev7a4X+Mme1HPnSf+A OQYySY2Cqi0fm6H2gBhy9Y9fLW9u8xqlIWQlBzSk= From: Pierre Ducroquet To: pgsql-hackers@lists.postgresql.org Subject: Re: Query is over 2x slower with jit=on Date: Wed, 22 Aug 2018 20:48:48 +0200 Message-ID: <5943705.ai6g73NumU@pierred-pdoc> In-Reply-To: <20180822165155.tjbib4pewnbiyy4x@alap3.anarazel.de> References: <20180822161241.je6nghzjsktbb57b@alap3.anarazel.de> <20180822165155.tjbib4pewnbiyy4x@alap3.anarazel.de> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wednesday, August 22, 2018 6:51:55 PM CEST Andres Freund wrote: > On 2018-08-22 18:39:18 +0200, Andreas Joseph Krogh wrote: > > Just to be clear; The query really runs slower (wall-clock time), it's not > > just the timing. > > I bet it's not actually running slower, it "just" takes longer to start > up due to the JITing in each worker. I suspect what we should do is to > multiple the cost limits by the number of workers, to model that. But > without the fixed instrumentation that's harder to see... It depends on the query. It has been shown in other threads that query can indeed take longer to run because of JITing : if the cost is too low to fire LLVM optimizer, the generated code can be so bad it will be slower than the non-JIT executor. Cf for instance a previous discussion here : http://www.postgresql-archive.org/PATCH-LLVM-tuple-deforming-improvements-td6029385.html I think it would be interesting to try the query from this thread with a patch forcing the LLVM codegen to O1 (I found no PassManager there to play with, it seems to be an off/on/extreme switch ; patch 0001-LLVM-Use-the-O1-CodeGen- level.patch from thread mentioned above).