Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mHphe-0003Nv-TM for pgsql-performance@arkaria.postgresql.org; Sun, 22 Aug 2021 15:48:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mHphc-0000nW-HE for pgsql-performance@arkaria.postgresql.org; Sun, 22 Aug 2021 15:48:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mHphc-0000nO-40 for pgsql-performance@lists.postgresql.org; Sun, 22 Aug 2021 15:48:04 +0000 Received: from mail-io1-xd2e.google.com ([2607:f8b0:4864:20::d2e]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mHpha-0000cc-3o for pgsql-performance@postgresql.org; Sun, 22 Aug 2021 15:48:03 +0000 Received: by mail-io1-xd2e.google.com with SMTP id f6so11130187iox.0 for ; Sun, 22 Aug 2021 08:48:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=U8DPkne2jBIMkTq6bxeKVzJ7QMwbCuIxIDe++TffFdE=; b=jeYkZTUTsl5xf+3jpUD1IFJSPw+s34tEelFbwSv72xmhoHF2DEldjj/m6WGPtD+eUI K3QLde+C9d5lBH9bsBi/zhSf3EGII5TcynQTFeGiYaJZ9quBntAs3FQ+NSQbMvIJzrfW 1PD+fVCBdFAMDlzjlI3fM9j48xA7Y9sJ9YoHUuJE6o+x9Yh+T1ohRVSpGAEo9jObcZbL 0aIJWMbA+Eg6NEfLd0/keQdwyxvnOnoffYy1/oszbkvyYrDIks4YkiL4cfXxatvuONhD IamnfBgzOFjL+kUMy/1WZi7UEq2LxJ9HgzVt7YEpEQs+dMo0rFBXLfWQvsUaqVoUKkIT Za0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=U8DPkne2jBIMkTq6bxeKVzJ7QMwbCuIxIDe++TffFdE=; b=Rs55hWUUKzure+hsLnyukMlmLLnmqRlSeHspMuue6RZZK7x+iKwV8OpYzPMBkZt6jy FNSKYmUbwMHpI9dDKDAjZjAMMQE83aLJQmM+mWngRP8mx46KdBF/AguwjrYyqGnpVBn6 hf/8rKxCjOcSfZgiPnCyukWe7SgSY3eHyA6Hb6YZZT/E6HJJCJFvtxnRMz8ir8OXvdJg LLLTGdfwvMsHNBRnoqlY0RDniWHD8TTHdIVzRRemjdWJRroAF6t+yLdSIcEH4zDrvjsI mfNfIADDFijITFrDsMv4QfZIlmp2LCYLLmG7lK022O8M5skDDloQnMO1f9WN2dFYrk0d Kjkg== X-Gm-Message-State: AOAM533hCQOPwS6nTZBaiqPh7fsG+yqIGXq260zKfyQVENZ13ej91Pmo TUi6uTwVv2OJAxSFf3Jqp34zLQ== X-Google-Smtp-Source: ABdhPJwBmHBBn9kXBLk5qEDbn37SNzVVF+LAhSfuAf7NbV8xlDhWem9GnpBp6ufqkRj957SzOTkx6Q== X-Received: by 2002:a5d:8484:: with SMTP id t4mr22636636iom.126.1629647280091; Sun, 22 Aug 2021 08:48:00 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id v15sm6826477ilq.2.2021.08.22.08.47.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Aug 2021 08:47:59 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 93102800B38; Sun, 22 Aug 2021 10:47:58 -0500 (CDT) Date: Sun, 22 Aug 2021 10:47:58 -0500 From: Justin Pryzby To: Ranier Vilela Cc: ldh@laurent-hasson.com, Tom Lane , pgsql-performance@postgresql.org Subject: Re: Big Performance drop of Exceptions in UDFs between V11.2 and 13.4 Message-ID: <20210822154758.GZ10479@telsasoft.com> References: <2092859.1629558281@sss.pgh.pa.us> <2136207.1629569846@sss.pgh.pa.us> <20210821191950.GW10479@telsasoft.com> <20210821221729.GY10479@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Aug 22, 2021 at 10:50:47AM -0300, Ranier Vilela wrote: > > Tried to check this with Very Sleepy at Windows 10 (bare metal). > > Not sure it can help if someone can guide how to test this better? > explain (analyze,buffers,COSTS,TIMING) select MAX(toFloat(a, null)) as "a" from sampletest; Your 100sec result *seems* to reproduce the problem, but it'd be more clear if you showed the results of both queries (toFloat(a) vs toFloat(b)). Laurent's queries took 800sec vs 2sec. > postgres.png (print screen from Very Sleepy) > postgres.csv This looks useful, thanks. It seems like maybe win64 builds are very slow running this: exec_stmt_block() / BeginInternalSubTransaction() / AbortSubTransaction() / reschedule_timeouts() / schedule_alarm() / setitimer() / pg_timer_thread() / WaitForSingleObjectEx () We should confirm whether there's a dramatic regression caused by postgres source code (and not by compilation environment or windows version changes). Test if there's a dramatic difference between v11 and v12, or v12 and v13. To be clear, the ~4x difference in v11 between Laurent's "exceptional" and "nonexceptional" cases is expected. But the 400x difference in v13 is not. If it's due to a change in postgres source code, we should find what commit caused the regression. First, check if v12 is affected. Right now, we know that v11.2 is ok and v13.4 is not ok. Then (unless someone has a hunch where to look), you could use git bisect to find the culprit commit. Git log shows 85 commits affecting those files across the 2 branches - once we determine whether v12 is affected, that alone eliminates a significant fraction of the commits to be checked. git log --oneline --cherry-pick origin/REL_11_STABLE...origin/REL_13_STABLE src/backend/access/transam/xact.c src/backend/port/win32/timer.c src/backend/utils/misc/timeout.c src/pl/plpgsql/src/pl_exec.c -- Justin