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 1jPFmL-0000YE-7H for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Apr 2020 01:26:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jPFmJ-0006us-U7 for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Apr 2020 01:26:47 +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 1jPFmJ-0006t4-N4 for pgsql-hackers@lists.postgresql.org; Fri, 17 Apr 2020 01:26:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jPFmH-0003vC-3M for pgsql-hackers@postgresql.org; Fri, 17 Apr 2020 01:26:47 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 03H1QeuU020404; Thu, 16 Apr 2020 21:26:40 -0400 From: Tom Lane To: Tomas Vondra cc: James Coleman , Justin Pryzby , pgsql-hackers Subject: Re: sqlsmith crash incremental sort In-reply-to: <20200417005420.ye342t2nljg4nuhk@development> References: <20200411191952.GA30754@telsasoft.com> <20200411202639.2o7quia37zd6ypw7@development> <20200411214639.GK2228@telsasoft.com> <20200411224445.x4whiaeo67glpqen@development> <20200413000943.bejni6axj7v4q5rn@development> <20200415144712.wyvpgvsujzzcf2qg@development> <20200417005420.ye342t2nljg4nuhk@development> Comments: In-reply-to Tomas Vondra message dated "Fri, 17 Apr 2020 02:54:20 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <20402.1587086800.1@sss.pgh.pa.us> Date: Thu, 16 Apr 2020 21:26:40 -0400 Message-ID: <20403.1587086800@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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. regards, tom lane