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 1kK8Pf-0003kS-Ne for pgsql-hackers@arkaria.postgresql.org; Sun, 20 Sep 2020 23:06:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kK8Pe-0007sg-Lz for pgsql-hackers@arkaria.postgresql.org; Sun, 20 Sep 2020 23:06:30 +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 1kK8Pe-0007sX-Fc for pgsql-hackers@lists.postgresql.org; Sun, 20 Sep 2020 23:06:30 +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 1kK8Pc-0001Bw-3R for pgsql-hackers@postgresql.org; Sun, 20 Sep 2020 23:06:29 +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 08KN69eh896114; Sun, 20 Sep 2020 19:06:09 -0400 From: Tom Lane To: Justin Pryzby cc: Heikki Linnakangas , "Andrey M. Borodin" , Darafei =?utf-8?Q?Kom=D1=8Fpa?= Praliaskouski , Pavel Borisov , Thomas Munro , Michael Paquier , Alexander Korotkov , pgsql-hackers@postgresql.org Subject: Re: Yet another fast GiST build In-reply-to: <20200920224446.GF30557@telsasoft.com> References: <7d9158ca-d7cb-88f0-dbbd-1d5cec32b1ae@iki.fi> <8516B6A8-11B2-41A8-B7EB-D0C38ADD06C3@yandex-team.ru> <50e03197-6e75-faec-16dc-41a2a38f080c@iki.fi> <123F5F32-9A85-4D0B-9C7A-1686E6BBE15D@yandex-team.ru> <85df399a-e8a4-2369-f723-fd1a3a872575@iki.fi> <884200.1600634472@sss.pgh.pa.us> <891385.1600636205@sss.pgh.pa.us> <20200920224446.GF30557@telsasoft.com> Comments: In-reply-to Justin Pryzby message dated "Sun, 20 Sep 2020 17:44:46 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <896112.1600643169.1@sss.pgh.pa.us> Date: Sun, 20 Sep 2020 19:06:09 -0400 Message-ID: <896113.1600643169@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Justin Pryzby writes: > This also appears to break checksums. I was wondering about that, because the typical pattern for use of smgrextend for indexes seems to be RelationOpenSmgr(rel); PageSetChecksumInplace(page, lastblock); smgrextend(rel->rd_smgr, MAIN_FORKNUM, lastblock, zerobuf.data, false); and gist_indexsortbuild wasn't doing either of the first two things. gist_indexsortbuild_flush_ready_pages looks like it might be a few bricks shy of a load too. But my local CLOBBER_CACHE_ALWAYS run hasn't gotten to anything except the pretty-trivial index made in point.sql, so I don't have evidence about it. Another interesting point is that all the other index AMs seem to WAL-log the new page before the smgrextend call, whereas this code is doing it in the other order. I strongly doubt that both patterns are equally correct. Could be that the other AMs are in the wrong though. regards, tom lane