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 1jQJf0-000589-Rs for pgsql-hackers@arkaria.postgresql.org; Sun, 19 Apr 2020 23:47:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jQJez-0006Pu-MR for pgsql-hackers@arkaria.postgresql.org; Sun, 19 Apr 2020 23:47:37 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jQJez-0006Pn-CM for pgsql-hackers@lists.postgresql.org; Sun, 19 Apr 2020 23:47:37 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jQJew-0002Xs-ON for pgsql-hackers@postgresql.org; Sun, 19 Apr 2020 23:47:36 +0000 Received: by mail-wm1-x32f.google.com with SMTP id y24so9356070wma.4 for ; Sun, 19 Apr 2020 16:47:34 -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=23jdOfQnaS6piRiTXmCW89aKYx6Ec5n1r21lQeU0SE4=; b=OcGpeS8Pk4gYYQMvJflZDzsFzorZlRETp1SB39avaePHuZb4DinuZ7Tz8FgtUkvWTu huVJSKYvgxnAYGh+t8isLJSlBiol2U10GlG1txcuSJr5tCUMLrtSPyKFOE2YbaC4DJfX UD3YWC+5EFQlBEavmn11L4wY0LL+qTK04MisWI8HbkSru8kKWSiA81DXKwyV/XPZRiOp 71TfSZYEzHIjAb/VovPs0pnQnDIKfMYM8RXVT/MMlwH8uZlOVPSkc6upI1bcLPTGfWRm tR3qGLXjDrCsAaNdqaVN860m0K9i2BD0lGX9E7EtRW2yXElOPbLkAKdfUMZeVTrz9KmI 3GRA== 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=23jdOfQnaS6piRiTXmCW89aKYx6Ec5n1r21lQeU0SE4=; b=X40bpsiGYK4VbgXIh7MhKK5wvZAUkxeUCEdQ66AkM/+ZRSLuoZXKl0axtPFVledil/ uxWNCfydpe93kLh8fZmVDU/wkVqPMMzjQyoKnW8CZmPIyudBoT3dE3cwthPD+XLKO93Z aiMdlaYNWnEaW16Tu5WLwhxHx7v2t5K3whSRLGM46Kp+kKUrDS4DMYz56zgzBEZrO/bX AOg7o6Fj7uSa4ewHTvN6HHIiozpDpXy4cmoBrFhFOCv0/o2vQ70pz+fKVufjvl1z5wen DUUE57tpaAPyKPge+Mg0Dt8sWtjkdGAJJJSkRW3RNPGMfiSl8zRVzyQI+H+RkC02YWuF gD5w== X-Gm-Message-State: AGi0PuZLzYwXGktmNnRh20nu7sAjC+yPEemrjG2Qs9gJ69I9ZuhdzVU2 PNq33A4Koy4DBNhBqC6J1kpZ4g== X-Google-Smtp-Source: APiQypKv7Pw4MIkuerrL7v5/Yh2EE/OonjAx3Q3d49J8v9m9XaSIGjUQp+kDF4tW99NxjGLd/2ZZAQ== X-Received: by 2002:a1c:2392:: with SMTP id j140mr14624111wmj.136.1587340053290; Sun, 19 Apr 2020 16:47:33 -0700 (PDT) Received: from localhost (ip-86-49-253-141.net.upcbroadband.cz. [86.49.253.141]) by smtp.gmail.com with ESMTPSA id e5sm42943945wru.92.2020.04.19.16.47.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 16:47:32 -0700 (PDT) Date: Mon, 20 Apr 2020 01:47:29 +0200 From: Tomas Vondra To: James Coleman Cc: Tom Lane , Justin Pryzby , pgsql-hackers Subject: Re: sqlsmith crash incremental sort Message-ID: <20200419234729.tglhf2iqlpkkpk3m@development> References: <20200411202639.2o7quia37zd6ypw7@development> <20200411214639.GK2228@telsasoft.com> <20200411224445.x4whiaeo67glpqen@development> <20200413000943.bejni6axj7v4q5rn@development> <20200415144712.wyvpgvsujzzcf2qg@development> <20200417005420.ye342t2nljg4nuhk@development> <20403.1587086800@sss.pgh.pa.us> 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 Sat, Apr 18, 2020 at 02:23:25PM -0400, James Coleman wrote: >On Thu, Apr 16, 2020 at 9:26 PM Tom Lane wrote: >> >> Tomas Vondra writes: >> > I think we have essentially three options: >> > 1) assuming there's just a single group >> > 2) assuming each row is a separate group >> > 3) something in between >> > If (1) and (2) are worst/best-case scenarios, maybe we should pick >> > something in between. We have DEFAULT_NUM_DISTINCT (200) which >> > essentially says "we don't know what the number of groups is" so maybe >> > we should use that. >> >> I wouldn't recommend picking either the best or worst cases. >> >> Possibly DEFAULT_NUM_DISTINCT is a sane choice, though it's fair to >> wonder if it's quite applicable to the case where we already know >> we've grouped by some columns. > >Do you think defining a new default, say, >DEFAULT_NUM_DISTINCT_PRESORTED is preferred then? And choose some >value like "1/2 of the normal DEFAULT_NUM_DISTINCT groups" or some >such? > If we had a better intuition what a better value is, maybe. But I don't think we have that at all, so I'd just use the existing one. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services