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 1oLVQG-0007MD-49 for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Aug 2022 20:01:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oLVPG-00089B-So for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Aug 2022 20:00:50 +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 1oLVPG-000891-Hs for pgsql-hackers@lists.postgresql.org; Tue, 09 Aug 2022 20:00:50 +0000 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oLVP9-0006FS-NZ for pgsql-hackers@postgresql.org; Tue, 09 Aug 2022 20:00:50 +0000 Received: by mail-pg1-x536.google.com with SMTP id q16so12333317pgq.6 for ; Tue, 09 Aug 2022 13:00:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=oknYImEfhmtcH9erUtRBGKkAxfI5zWGAcZ2zf7guiQU=; b=aXG7RJEGAjsAZC+r1iolBPXzyjFttAivEHgFN8dOAHYEoW9JFzzegannXHjTuS3nrG I0Cpmm6nD0q7ckyam0X2shV+EnoQL3AkNazcv/2IXXVyxlrpIPPYn47XjRQ6iL8HwK6X uIYW27PktHBcKfEKcuJj9qrqWGXxrlgC0poZnQbqAHZ7M7AjBBUCtHbLuvEkfqXsw+OP ItFK9EUKOW+TUDNVCepzpkb86+l/rLfn9LBolBkYTAQseVF+7KvtjvysfJP6R71T8VSo i9c9DOicz2OVjtOFBav1wxmNjJUuht3abF4n/ZAh3YtjSn2nJZLPTwYomRrAQneREeGR I5XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=oknYImEfhmtcH9erUtRBGKkAxfI5zWGAcZ2zf7guiQU=; b=MTsanuVDkde3gtD1cNlmY7NTb5zXAAH2wXURqx70xu3xU1H+UK6l+C+lNQO3MzDYZD t7C/nRI6wKGt6e+O84PZHkKV5l2QGG8P8AuiU5TSy0ZaRTy1iIRm6CNuk0ixkPxVyNyv +jIWecoIcaTBOd5Y8T/CvEfsfjSLf2dME49IAAMRwPQys4VfwCd1enVh9+qrB5WYXLv9 ldQSFWiETJPWQqRGHqizz7RKvcnOfGe6CWY0GON1RpIshQLNy6sYy33iB5+385JJ7SV9 cnW/0dF8PgNK5YK0jHNLxFrhtHEYnhoSkVJvUUoxEspIHPGvcuM0wKLqU7QNmz/nX3nA uUrA== X-Gm-Message-State: ACgBeo3dXNGxp6OQH+IOki7Gnw9s91Yic2PCajigF5fkUqvmOc3CnxbN RDPX9ZlgBpjV6chhEzdTm8w= X-Google-Smtp-Source: AA6agR78d9DQ+zMOuEOutgxL/D1A0cTbDQITuLMz+ZhtnhzoMkbdWbcDWiqUdZ3dYFgm/MnZFKbSdQ== X-Received: by 2002:a05:6a00:1996:b0:52e:b0f7:8c83 with SMTP id d22-20020a056a00199600b0052eb0f78c83mr21688191pfl.59.1660075241050; Tue, 09 Aug 2022 13:00:41 -0700 (PDT) Received: from nathanxps13 ([50.54.155.70]) by smtp.gmail.com with ESMTPSA id o10-20020a170902d4ca00b0016bcc35000asm11225770plg.302.2022.08.09.13.00.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Aug 2022 13:00:40 -0700 (PDT) Date: Tue, 9 Aug 2022 13:00:37 -0700 From: Nathan Bossart To: John Naylor Cc: Masahiko Sawada , Andres Freund , John Naylor , pgsql-hackers Subject: Re: optimize lookups in snapshot [sub]xip arrays Message-ID: <20220809200037.GA1490626@nathanxps13> References: <20220805202510.GA1208450@nathanxps13> <20220805220434.6h2aa7eww5rxird6@awork3.anarazel.de> <20220806181326.GA1216305@nathanxps13> <20220806212522.GA1221353@nathanxps13> <20220808223254.GA1393216@nathanxps13> <20220809035129.GA1440829@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Aug 09, 2022 at 01:21:41PM +0700, John Naylor wrote: > I decided I wasn't quite comfortable changing snapshot handling > without further guarantees. To this end, 0002 in the attached v11 is > an addendum that adds assert checking (also pgindent and some > comment-smithing). As I suspected, make check-world passes even with > purposefully screwed-up coding. 0003 uses pg_lfind32 in syscache.c and > I verified that sticking in the wrong answer will lead to a crash in > assert-enabled builds in short order. I'd kind of like to throw this > (or something else suitable) at the build farm first for that reason. > It's simpler than the qsort/qunique/binary search that was there > before, so that's nice, but I've not tried to test performance. Your adjustments in 0002 seem reasonable to me. I think it makes sense to ensure there is test coverage for pg_lfind32(), but I don't know if that syscache code is the right choice. For non-USE_SSE2 builds, it might make these lookups more expensive. I'll look around to see if there are any other suitable candidates. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com