Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ir7zY-00033N-7R for pgsql-performance@arkaria.postgresql.org; Mon, 13 Jan 2020 22:15:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ir7zX-0005rc-3N for pgsql-performance@arkaria.postgresql.org; Mon, 13 Jan 2020 22:15:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ir7zW-0005rV-QB for pgsql-performance@lists.postgresql.org; Mon, 13 Jan 2020 22:15:22 +0000 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ir7zQ-0007eP-5X for pgsql-performance@postgresql.org; Mon, 13 Jan 2020 22:15:22 +0000 Received: by mail-qk1-x743.google.com with SMTP id a203so10283955qkc.3 for ; Mon, 13 Jan 2020 14:15:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=S/vVyad9fovkK6KtAEbDpAAaEIV6vBHR9aAPdHWlp+o=; b=f1tE9bOVB1cc4B9GDzTw1JGrbv3ilYzq3X0SJmuAvPjz2h4lQpV96sq5HxDwnQwkdX PRphdyxkAgsczgVoiLpLjQDXb3JFh94MitXKFRQ4kVakCnGvgZ4hhLKVsRy+hZrqx4Cv olWYl4fOjUQjy4yhrP7XdQ9vusFhrZOc/RAGrz6BRorCSQCop/vW/ItdXofhQwlnfdbb wIUbWAkUua1El2NCZR1VFJUO/uhiyNn1oFVJFiwQ39QGMbsjw8k2zWKWgt1frxjN5dMm SWPt5XunqvI8oClE0zVvjiTL8hObwVxfHJAinigzc+0insz3zA1Uvwh2r5sonrYI4Guf pFeA== 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:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=S/vVyad9fovkK6KtAEbDpAAaEIV6vBHR9aAPdHWlp+o=; b=HkNqzlfEPDWTAUWiibnUtcDxxMOe03En6B6OF7LGu3EBe6ILQrkbXsZBRCFpXYH4MS CjmNQ9CQypY9+c1c4voalzFZPFRxmPy9Brk8MmK6FT0xNYzwQCz51krMarpykY+nfh3+ KjCheo9W6bAUWiL24nHbkw3CgT0gDSAHMVw/hWFAoP0cuBtLL+/9ETSJS6VNmfI6kCn3 +ru500s1k0mkJAc+j5XBEv0souQAia8UVSezSqTClcH1yncPaDPPo3BFDpRUUoU7rPoS JN7zgDmqF4wiF4cKjWeGSmsP2eQR8/vOkTallmLNd9PvUKFE0ULyiE/js6ahgW/hlvCq PgvQ== X-Gm-Message-State: APjAAAU5AnvBWyGEZTq1HYh/enp7QCTMVjlogHCu7LktOzk1g+UlrchI ib87OkaH10jZfbhvxfrjm8ZCBimNnymVQOGIbiWRA04KG+SnjZZhyUHS2W6wqxH9Bp10JzcUk6W rx/3HCql1bODEAI3z3UISqF5C8fGrjqBrzaQTxqOrcNRbN2rgVrkm1VQ9knFD29xxNowtRce54n GVAzrH7xgmoz8= X-Google-Smtp-Source: APXvYqwmp1ZjfqXFQPNf3l41hj+RyGJNnKjVyTjKoe/bSkLiUxs0r7SsTC77une7M5emv0KEAqSCOg== X-Received: by 2002:ae9:e907:: with SMTP id x7mr14093337qkf.298.1578953713870; Mon, 13 Jan 2020 14:15:13 -0800 (PST) Received: from nimloth.alvh.no-ip.org ([190.95.19.128]) by smtp.gmail.com with ESMTPSA id u55sm6639505qtc.28.2020.01.13.14.15.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jan 2020 14:15:13 -0800 (PST) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id B27BB30081F; Mon, 13 Jan 2020 19:15:11 -0300 (-03) Date: Mon, 13 Jan 2020 19:15:11 -0300 From: Alvaro Herrera To: Shira Bezalel Cc: pgsql-performance@postgresql.org Subject: Re: Seeking reason behind performance gain in 12 with HashAggregate Message-ID: <20200113221511.GA4959@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Jan-13, Shira Bezalel wrote: > Hi All, > > I'm testing an upgrade from Postgres 9.6.16 to 12.1 and seeing a > significant performance gain in one specific query. This is really great, > but I'm just looking to understand why. pg12 reads half the number of buffers. I bet it's because of this change: commit 4d0e994eed83c845a05da6e9a417b4efec67efaf Author: Stephen Frost AuthorDate: Tue Apr 2 12:35:32 2019 -0400 CommitDate: Tue Apr 2 12:35:32 2019 -0400 Add support for partial TOAST decompression When asked for a slice of a TOAST entry, decompress enough to return the slice instead of decompressing the entire object. For use cases where the slice is at, or near, the beginning of the entry, this avoids a lot of unnecessary decompression work. This changes the signature of pglz_decompress() by adding a boolean to indicate if it's ok for the call to finish before consuming all of the source or destination buffers. Author: Paul Ramsey Reviewed-By: Rafia Sabih, Darafei Praliaskouski, Regina Obe Discussion: https://postgr.es/m/CACowWR07EDm7Y4m2kbhN_jnys%3DBBf9A6768RyQdKm_%3DNpkcaWg%40mail.gmail.com -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services