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 1jbmVa-0007hu-Ir for pgsql-hackers@arkaria.postgresql.org; Thu, 21 May 2020 14:49:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jbmVZ-00047Q-Br for pgsql-hackers@arkaria.postgresql.org; Thu, 21 May 2020 14:49:17 +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 1jbmRm-0000K2-QQ for pgsql-hackers@lists.postgresql.org; Thu, 21 May 2020 14:45:22 +0000 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jbmRf-0002BN-QX for pgsql-hackers@postgresql.org; Thu, 21 May 2020 14:45:22 +0000 Received: by mail-ej1-x62c.google.com with SMTP id h21so9141976ejq.5 for ; Thu, 21 May 2020 07:45:15 -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=HYejUrrq+125ILqE9ha81l9CL0egnXBQsU3PT1tTxOA=; b=D9dgj20vyCUQ0wnlEtslhx5XbSfkDblmVnEoDkn3jliAIpBTboxdvSbEOmFs4/0QEe ddIi3C3RmcDHk9rWdl1l1G4nNI6lMkukLHLD0DiCo75RhXSg6I4jm2r4zz9TWMAzUD19 aeRXOn0KBGTVWoTHaHZSgZHKkx8g3GdKkOtsGzosOy+boPvqcQRwA+6lkPdbCQQt2SB5 p4U+bpYmYVQULITCpkpMTMtXyzUN5I5E72WPctphTcFqgdvECEyy0JktFKJdILqgLwNV pPtde1+C3JHiD348ptsHB/TJxCG83eTr9Ezsp44OoIQb4QVkyvhFBZmxAflScJwLopbW /7FQ== 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=HYejUrrq+125ILqE9ha81l9CL0egnXBQsU3PT1tTxOA=; b=bH5J+/Scdn/IawQGtm6Fz9fyduSwIWvQfMT8tTiMyvvKVZirk/U0foRFCn2AFZPtRq Nr0vz4j/SX2hTXeSmE3WJzGidxVae9kldjkZ2qNkhL+okm9k4YA1IpB5t/jr5UAfl2st /KIG01LW4TenegDCIRByUNv0f2NcV0mSiHHAXOl9hpichdvErlGE6ANru8gJ+u90Bazq wU+u9PasNuKEuOvdppWwBqO9q39678dRaeuhQKZaSg+l8HW4cc9mbZExpUr0yCzwjvMN Z4j/da/Bf374kqSPNCGJHzBfBVWE3eZphvsJbxO1fbR6BAVynwKdH3XLPPJff+DNTava 6Tdg== X-Gm-Message-State: AOAM533BmS41ZICUMllKUMfawRaYwjHfrK/42hgBzE4evY4HS0Qg77IL RDwZGMw5xzpiaLcSP8JKcPyTdQ== X-Google-Smtp-Source: ABdhPJwS5iDjoWd2A0pEwn0xp+JlBq8jnl3prWO9z1OGmWONWOXya7F0XQnkI85fNPA75AQyXlMDiw== X-Received: by 2002:a17:906:c838:: with SMTP id dd24mr3824749ejb.28.1590072313764; Thu, 21 May 2020 07:45:13 -0700 (PDT) Received: from localhost (ip-86-49-253-141.net.upcbroadband.cz. [86.49.253.141]) by smtp.gmail.com with ESMTPSA id h25sm5130835ejx.7.2020.05.21.07.45.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 07:45:12 -0700 (PDT) Date: Thu, 21 May 2020 16:45:10 +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: <20200521144510.2kz5rw2hjqdnf3iz@development> References: <20200519151202.u2p2gpiawoaznsv2@development> <88dd39d782178539d7ee46f98b98579940e2a12e.camel@j-davis.com> <20200519175320.tl4qm6le5dbg2pcf@development> <20200521001255.kfaihp3afv6vy6uq@development> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20200521001255.kfaihp3afv6vy6uq@development> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, May 21, 2020 at 02:12:55AM +0200, Tomas Vondra wrote: > > ... > >I agree that's pretty nice. I wonder how far would we need to go before >reaching a plateau. I'll try this on the other machine with temporary >tablespace on SATA, but that'll take longer. > OK, I've managed to get some numbers from the other machine, with 75GB data set and temp tablespace on SATA RAID. I haven't collected I/O data using iosnoop this time, because we already know how that changes from the other machine. I've also only done this with 128MB work_mem, because of how long a single run takes, and with 128 blocks pre-allocation. The patched+tlist means both pre-allocation and with the tlist tweak I've posted to this thread a couple minutes ago: master patched patched+tlist ----------------------------------------------------- sort 485 472 462 hash 24686 3060 559 So the pre-allocation makes it 10x faster, and the tlist tweak makes it 5x faster. Not bad, I guess. Note: I've slightly tweaked read-ahead on the RAID device(s) on those patched runs, but the effect was pretty negligible (compared to other patched runs with the old read-ahead setting). regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services