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 1oFphp-0008UA-NI for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Jul 2022 04:28:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oFpho-0006Ia-1T for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Jul 2022 04:28:32 +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 1oFphn-0006IR-Mt for pgsql-hackers@lists.postgresql.org; Mon, 25 Jul 2022 04:28:31 +0000 Received: from mail-oi1-x242.google.com ([2607:f8b0:4864:20::242]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oFphl-0007W8-8n for pgsql-hackers@postgresql.org; Mon, 25 Jul 2022 04:28:30 +0000 Received: by mail-oi1-x242.google.com with SMTP id u76so12235786oie.3 for ; Sun, 24 Jul 2022 21:28:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=FZPrSj0qUj/5O5m18EdnhcA0RfkVPF80cVCY4qZILUE=; b=es3vVxFAlRCK+2mHBxviw5z8iPYl6wcmGaNKEO5tllGQ7yB/5WGatL7SGWIYT8Nb5J zKF3UlbhMfqaBdFO83V8LfPEZmOOK61Iyh0UE+tuWp3Q8L9qUpiMVe+C+n/xiBV8xojx HEqoyi1de8GnjyPIcJzhtO/7hhUj5tONp7I+GFGqU5rJRQfQpCZKlbvhKoMOpJZKjJ9O gA5Sbth1rRAAkizU1Qe9YCp/MemxGh7DhgNk+aQ5ODX3AT99ss6yLKQnxkRBhFYbPmpq f4eC//rhtnS6SaqKRq2C3gwZHNKAq19OtrOEqBu+rnvGiYf5PVn5uNYC7QE7K6uhMOyW cazA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=FZPrSj0qUj/5O5m18EdnhcA0RfkVPF80cVCY4qZILUE=; b=o/080aKtOHEy5FLVW0PsktPdhq9PoYzgtazLOP970G27lFcAuMwk0lkvQuBLiJCfjf a0Q2b0V665NvKB2rHF3skGZ6DFIUojjDNODVEaNdRP5FuOahNpliOqIS8WeEhI/1rOTD vhCuPL4+p9RWZRKwQBr0yDf2AtIQtbVyZuy9swcODczWcT3KBmzhpdV0an2IfcXpyFMz ehaqIqEvAf/JmKcXz+2vLTd9fJedZ0jDy6ssi4kijgaKfjy3zJoChRtHRBmQ937FuKS4 Dplu32T31xT1JxT44qeW6AFi2yFGWaLtXKB61xsrnkt3l72XUWbViUZ9dKxhIVJqzSPZ PC0g== X-Gm-Message-State: AJIora8utmvEmlNEiv5B9qrEqfKZqobZmodbpQ+rioP/avG3qsLsd+Pe 0x05yFbrYtidPAipCxwB0ms= X-Google-Smtp-Source: AGRyM1sioGpZYsdd6udnGkBfs+O5zU6B389Cw59iE9yHKG6tmets58PZYgC+pI87q3MTDuhbE7bSmg== X-Received: by 2002:aca:1103:0:b0:33a:c295:f483 with SMTP id 3-20020aca1103000000b0033ac295f483mr5398841oir.80.1658723308500; Sun, 24 Jul 2022 21:28:28 -0700 (PDT) Received: from smtpclient.apple ([206.190.130.164]) by smtp.gmail.com with ESMTPSA id c11-20020a056870478b00b00101bc3380a5sm5483083oaq.12.2022.07.24.21.28.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Jul 2022 21:28:28 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.80.82.1.1\)) Subject: Re: optimize lookups in snapshot [sub]xip arrays From: Zhang Mingli In-Reply-To: <20220725040856.GB4085281@nathanxps13> Date: Mon, 25 Jul 2022 12:28:23 +0800 Cc: pgsql-hackers@postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <20220713170950.GA3116318@nathanxps13> <76ACEAF0-8050-41D5-B2F5-01164533BE99@gmail.com> <20220725040856.GB4085281@nathanxps13> To: Nathan Bossart X-Mailer: Apple Mail (2.3696.80.82.1.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Got it, thanks. Regards, Zhang Mingli > On Jul 25, 2022, at 12:08, Nathan Bossart = wrote: >=20 > On Sun, Jul 24, 2022 at 12:48:25PM +0800, Zhang Mingli wrote: >> If snaphost->suboverflowed is false then the subxcnt must be less = than PGPROC_MAX_CACHED_SUBXIDS which is 64 now. >>=20 >> And we won=E2=80=99t use hash if the xcnt is less than = XIP_HASH_MIN_ELEMENTS which is 128 currently during discussion. >>=20 >> So that, subxid=E2=80=99s hash table will never be used, right? >=20 > This array will store up to TOTAL_MAX_CACHED_SUBXIDS transactions, = which > will typically be much greater than 64. When there isn't any = overflow, > subxip stores all of the subxids for all of the entries in the = procarray. >=20 > --=20 > Nathan Bossart > Amazon Web Services: https://aws.amazon.com