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 1ok4q3-00075O-9M for pgsql-hackers@arkaria.postgresql.org; Sun, 16 Oct 2022 14:42:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ok4q1-0008J1-UP for pgsql-hackers@arkaria.postgresql.org; Sun, 16 Oct 2022 14:42:01 +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 1ok4q1-0008Ir-LU for pgsql-hackers@lists.postgresql.org; Sun, 16 Oct 2022 14:42:01 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ok4pz-0006Ju-I8 for pgsql-hackers@lists.postgresql.org; Sun, 16 Oct 2022 14:42:00 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 29GEfvot1698652; Sun, 16 Oct 2022 10:41:57 -0400 From: Tom Lane To: Tomas Vondra cc: PostgreSQL Hackers Subject: Re: PATCH: Using BRIN indexes for sorted output In-reply-to: <1a7c2ff5-a855-64e9-0272-1f9947f8a558@enterprisedb.com> References: <1a7c2ff5-a855-64e9-0272-1f9947f8a558@enterprisedb.com> Comments: In-reply-to Tomas Vondra message dated "Sun, 16 Oct 2022 15:50:53 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1698650.1665931317.1@sss.pgh.pa.us> Date: Sun, 16 Oct 2022 10:41:57 -0400 Message-ID: <1698651.1665931317@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Tomas Vondra writes: > I forgot to mention one important issue in my list yesterday, and that's > memory consumption. TBH, this is all looking like vastly more complexity than benefit. It's going to be impossible to produce a reliable cost estimate given all the uncertainty, and I fear that will end in picking BRIN-based sorting when it's not actually a good choice. The examples you showed initially are cherry-picked to demonstrate the best possible case, which I doubt has much to do with typical real-world tables. It would be good to see what happens with not-perfectly-sequential data before even deciding this is worth spending more effort on. It also seems kind of unfair to decide that the relevant comparison point is a seqscan rather than a btree indexscan. regards, tom lane