Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZzY6m-0003pw-A2 for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Nov 2015 22:55:16 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZzY6l-00058J-Rv for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Nov 2015 22:55:15 +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_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZzY5Q-0003b6-Ow for pgsql-hackers@postgresql.org; Thu, 19 Nov 2015 22:53:52 +0000 Received: from mail-yk0-x229.google.com ([2607:f8b0:4002:c07::229]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZzY5N-00046Q-Ef for pgsql-hackers@postgresql.org; Thu, 19 Nov 2015 22:53:51 +0000 Received: by ykdr82 with SMTP id r82so132385830ykd.3 for ; Thu, 19 Nov 2015 14:53:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heroku-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=UN1mw15/fK6lrXyfeRD33PulNkHwYJVqPnu4O5T3g/g=; b=a9qLYtJbM/16VDHA9gvWJCts3whEVYRbE4ap2nvG4COA9+w+jGX1qK7j4XABU9XZCq xlEtdUp818JVaZ2/zrcJDVr/EBsJgHh/uWOGuazIry0RGc+I6W0xzq9XL7+LAG4GyIg5 YfmFeyb5TudWq+Pns20kmpQipAeG16CpeumC7oOFMQkF+pWJ8WCZB1+ose2gyasLMiX+ IgkkVCh/gXj4drc1LCqOoYrTnyn6jjVmYSyqgcUxhDDnOyYJn5j6cTrw4kM3g3agfEKQ S4UjdxGwxcxEJX7XpyxCv+J5uVL9+XCG89G++8b+ZhbTpIDaP/6MRhmwM94kzWooUv1X VGew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=UN1mw15/fK6lrXyfeRD33PulNkHwYJVqPnu4O5T3g/g=; b=GGTxM3d7c3EGNavpCFJUipEb1DkdXeciO1WQHyDpsIMlH/VjaQVMx0CntCMRvDELH6 vu6osCzhJo6FcVok/3S7lHc0qExy+eml8XcTqoQ7YsvVbXH/p/AY8MyHcfCqsoQoesyx UwmKJ/1dgK/6FepIg3I9eG+ne9w109oTASgjRGX6pqFj0yZcVhQHyjxo8qYzBrGAZdbz VwrwBZx+Pq9SfSbP9lAIJDMydR4D0ls1qhiFXS7v00DnzOZOdnsFz+yMqFa4gE5z+APy WlD/cOgCPcT++lG/k+wnGwg1lAd+nCAOU/Ly+/y/rCQOxOb8Uleje3P+jwapcTS9Muer iAHw== X-Gm-Message-State: ALoCoQlNBv6A+CQGlkqm9ohWPOMKZ93D69QMWaAUwkXqyDk4SWRL/PXNEis2oFwU2eHYhAjgrIdv MIME-Version: 1.0 X-Received: by 10.13.227.193 with SMTP id m184mr10517616ywe.16.1447973627162; Thu, 19 Nov 2015 14:53:47 -0800 (PST) Received: by 10.31.189.151 with HTTP; Thu, 19 Nov 2015 14:53:47 -0800 (PST) In-Reply-To: References: Date: Thu, 19 Nov 2015 14:53:47 -0800 Message-ID: Subject: Re: Using quicksort for every external sort run From: Peter Geoghegan To: Robert Haas Cc: Jeff Janes , Pg Hackers , Heikki Linnakangas , Simon Riggs Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Thu, Nov 19, 2015 at 2:35 PM, Robert Haas wrote: > OK, so reversing this analysis, with the default work_mem of 4MB, we'd > need a multi-pass merge for more than 235MB/4 = 58MB of data. That is > very, very far from being a can't-happen scenario, and I would not at > all think it would be acceptable to ignore such a case. > I think you need to revisit your assumptions here. Which assumption? Are we talking about multipass_warning, or my patch series in general? Obviously those are two very differently things. As I've said, we could address the visibility aspect of this differently. I'm fine with that. I'll now talk about my patch series in general -- the actual consequences of not avoiding a single pass merge phase when the master branch would have done so. The latter 16MB work_mem example query/table is still faster with a 12MB work_mem than master, even with multiple passes. Quite a bit faster, in fact: about 37 seconds on master, to about 24.7 seconds with the patches (same for higher settings short of 16MB). Now, that's probably slightly unfair on the master branch, because the patches still have the benefit of the memory pooling during the merge phase, which is nothing to do with what we're talking about, and because my laptop still has plenty of ram. I should point out that there is no evidence that any case has been regressed, let alone written off entirely or ignored. I looked. I probably have not been completely exhaustive, and I'd be willing to believe there is something that I've missed, but it's still quite possible that there is no downside to any of this. -- Peter Geoghegan -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers