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 1oFpOx-0007mn-TS for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Jul 2022 04:09: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 1oFpOw-0007TJ-Ps for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Jul 2022 04:09:02 +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 1oFpOw-0007T9-EW for pgsql-hackers@lists.postgresql.org; Mon, 25 Jul 2022 04:09:02 +0000 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oFpOu-0007Mk-8I for pgsql-hackers@postgresql.org; Mon, 25 Jul 2022 04:09:01 +0000 Received: by mail-pf1-x42f.google.com with SMTP id w205so6007275pfc.8 for ; Sun, 24 Jul 2022 21:09:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=C6WJFafxa6YEPqQs4CIg1PPwHVL2iVGvyuvKm46n7hE=; b=gRImXRWWWFmyXhXqmZ5DJ6oOuGhQP+INBACVS/NiY8DScIucqgH3D8ePX+vYUD+Tui 6fMkhadSSIHOIKuA/vRGDhSpxcnZEvKsEZaqaLqS2V8tI6Z8bCiPJ0Puc1hlG/iaa4OQ /iI3v1u+3CWstcF4fCcbc+i8pzjMVzSip79qbJ59AgeVK9yXLjFy6LpkB1G/PI87AiQ2 t1zpW5uRCT+cyLWWYxaEq0fbDydxf5NzK4v+zCQnw2xlW6vz2/VA6VoNPz+D2F5eJZZw /AfFs0P7K+OsO1j8x5Jpn9IzmtEHdoMam4nJNjcssjwnAHDUWbG2c1d+S0+v0q8i6Uhc YcPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=C6WJFafxa6YEPqQs4CIg1PPwHVL2iVGvyuvKm46n7hE=; b=P8MtulHt7EkCaIpvgDxuKzh2e8kQJ2ztO7AOoyReNAPbf74bvcleqCOA3AYsGQLgRH 4vOknQA+/n4dooxlidy/QcGMnnssOQdZ8BK9MLeJdkF3urncII3Hoy8cHkPNGSHvUPmL CutiDgUsokfPUcL+Fq4vJwWixprv8Oo9Mv0Y4gU2GlYFKRjDvvcZhdqSXVvhexZegDlC 5zGgtBXbWn+WYEDITD4dzkQmLolQI0O3bipjwx7+wiGk9g/HI38szKKYC/8+DFrqlBU1 VK/ivdvMUbGSFucYZtuqLrUgSNYZ2hgjwgrFyE9hQVUlSoUw2j0fTFTwvnX3N/qoaWiS C5KQ== X-Gm-Message-State: AJIora8hPH3XZ4GHTy10ykGjQ86yzxb1XtUbM1BJGZjv+4AFRBa3BOrm 4RVQ7YAzOyH7qxpY5jaHDpo= X-Google-Smtp-Source: AGRyM1sPuCVY8SnGaFk9NGGv58bweBGv1KR2ju8oOfETe6OykCcKCA6jDbilMKfnBt+a1HdHbOyNBQ== X-Received: by 2002:a05:6a00:885:b0:510:950f:f787 with SMTP id q5-20020a056a00088500b00510950ff787mr10642511pfj.83.1658722139095; Sun, 24 Jul 2022 21:08:59 -0700 (PDT) Received: from nathanxps13 ([50.54.155.70]) by smtp.gmail.com with ESMTPSA id r22-20020a170902be1600b0016c28a68ad0sm7872601pls.253.2022.07.24.21.08.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Jul 2022 21:08:58 -0700 (PDT) Date: Sun, 24 Jul 2022 21:08:56 -0700 From: Nathan Bossart To: Zhang Mingli Cc: pgsql-hackers@postgresql.org Subject: Re: optimize lookups in snapshot [sub]xip arrays Message-ID: <20220725040856.GB4085281@nathanxps13> References: <20220713170950.GA3116318@nathanxps13> <76ACEAF0-8050-41D5-B2F5-01164533BE99@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <76ACEAF0-8050-41D5-B2F5-01164533BE99@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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. > > And we won’t use hash if the xcnt is less than XIP_HASH_MIN_ELEMENTS which is 128 currently during discussion. > > So that, subxid’s hash table will never be used, right? 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. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com