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 1jbsKx-0001iV-L0 for pgsql-hackers@arkaria.postgresql.org; Thu, 21 May 2020 21:02:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jbsKw-0001no-D9 for pgsql-hackers@arkaria.postgresql.org; Thu, 21 May 2020 21:02:42 +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 1jbsKw-0001nh-32 for pgsql-hackers@lists.postgresql.org; Thu, 21 May 2020 21:02:42 +0000 Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jbsKs-0005rV-VW for pgsql-hackers@postgresql.org; Thu, 21 May 2020 21:02:41 +0000 Received: by mail-ed1-x543.google.com with SMTP id h16so7710696eds.5 for ; Thu, 21 May 2020 14:02:38 -0700 (PDT) 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:references:mime-version :content-disposition:in-reply-to; bh=3xY4vJOmtC1v5gMr6Rr8dPKh+M9ZwsJU6aMOaAPlujk=; b=M0YjvsICSFd5rroGpBk7iJtpFCx0Kin4WqFk82Z+cWYBTz4yDDjY/x0N2oD/jDGWDW 9fkJ1O8OL3MJ16j+4z6I5yB41uLXd8bOJTdGNzQEq7rPRwBVvfTOFVHUfSLaWUVFpD2I 2C/EsUo+9MJu2oglGCzwv6ZqeVLY1LZP5X0yCk6TX/rl8wk1pqCcPaD2GA9QeNCr/YXp GGygmFtPa+60sCvsD/AXRzZRHI4dD9QrDIyWUJvDvUpjFOGIBftaAG+lNFVPlw5lDiIY UEIh3wFOHzi+jvHm5o4lJnMl4A2h3wkZR/KISxWOIJtK5pD/VeIno0vg/Pwv9M83KkBb KeKQ== 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; bh=3xY4vJOmtC1v5gMr6Rr8dPKh+M9ZwsJU6aMOaAPlujk=; b=ZaEUYa2Iu1cyyGf8oflM+snmzT9uSLdW/uGpg3CubKt2CjyJulU3UCxTcmtRmAMWAC 0ouoIIIIdVbSvJoDMy1y/ds65zHBK/3AgSfDfhnkTbPj9tj58t4acHdqlZrU6fP0abf+ r3bBYvXn3Ffe+oXHTAtR5XtPCwannXwPBxLIOR2b5MGzE4b8RdqKXuWZzTH3J05m1IbF hp7t4zN7XOY6PrXSA90+9p5lTiGv2nXp3XWhMIAQDKiOAbjV74la6zk3w4ofNEzxuAQd bL0/Zr87ZVxQtGnmFPadG+QfucKmEBc2Uu/UvYkdd1Bf85YSMcA6LtAltoVfCyJKNsz2 aT3A== X-Gm-Message-State: AOAM532kd90cDiVd/LgGj0oUibG/A8ALQtt83qBN5isbd3IzZBXwkUSK wv/WevhZ+p3vtYFTg088ssLztvBdflI= X-Google-Smtp-Source: ABdhPJzjuApQschGMQrOLv6z3pjcELekA/+fbXw33xYjpuQlATrw0xUnD1Sl+70hBHTk70ilTxdfVA== X-Received: by 2002:a50:cdd8:: with SMTP id h24mr545158edj.260.1590094957122; Thu, 21 May 2020 14:02:37 -0700 (PDT) Received: from localhost (ip-86-49-253-141.net.upcbroadband.cz. [86.49.253.141]) by smtp.gmail.com with ESMTPSA id j26sm6000708ejc.118.2020.05.21.14.02.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 14:02:36 -0700 (PDT) Date: Thu, 21 May 2020 23:02:32 +0200 From: Tomas Vondra To: Jeff Davis Cc: pgsql-hackers@postgresql.org Subject: Re: Trouble with hashagg spill I/O pattern and costing Message-ID: <20200521210232.fw5mazn23eftho7y@development> References: <20200519151202.u2p2gpiawoaznsv2@development> <88dd39d782178539d7ee46f98b98579940e2a12e.camel@j-davis.com> <20200519175320.tl4qm6le5dbg2pcf@development> <20200521191318.gw3xjivrxracvzmg@development> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, May 21, 2020 at 12:40:23PM -0700, Jeff Davis wrote: >On Thu, 2020-05-21 at 21:13 +0200, Tomas Vondra wrote: >> 1) Instead of assigning the pages one by one, we can easily extend >> the >> API to allow getting a range of blocks, so that we don't need to call >> ltsGetFreeBlock in a loop. Instead we could call ltsGetFreeBlockRange >> with the requested number of blocks. > >ltsGetFreeBlock() just draws one element from a minheap. Is there some >more efficient way to get many elements from a minheap at once? > >> And we could keep just a min/max >> of free blocks, not an array with fixed number of elements. > >I don't quite know what you mean. Can you elaborate? > Ah, I forgot there's and internal minheap thing - I thought we're just incrementing some internal counter or something like that, but with the minheap we can't just get a range of blocks. So just disregard that, you're right we need the array. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services