Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rg6SU-004CFR-I7 for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Mar 2024 17:14:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rg6SR-00EDJf-Sb for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Mar 2024 17:14:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rg6SR-00EDJW-JZ for pgsql-hackers@lists.postgresql.org; Fri, 01 Mar 2024 17:14:04 +0000 Received: from mail-yw1-x112a.google.com ([2607:f8b0:4864:20::112a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rg6SP-002HjE-0P for pgsql-hackers@lists.postgresql.org; Fri, 01 Mar 2024 17:14:03 +0000 Received: by mail-yw1-x112a.google.com with SMTP id 00721157ae682-6098b9ed2a3so3043487b3.0 for ; Fri, 01 Mar 2024 09:14:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709313239; x=1709918039; darn=lists.postgresql.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=4cT+4J66xoUI7WOzbMtsmkCGWlaImmwZf4sSiT2gD0E=; b=LWacBCCQ7kny9XD/hCztuK1r5cZKpI9na8sNvqfpD6kJ1xVx5Tk9T67AtNSHsAk2hp IOUG2OBkYZg24NDqnWESxccn8YqKZE3VSk/vBQPL5ACCucIZleOjfB8QxQ3nbksECzDJ aD2RsffZfqrjygCeouW3JZcyO0XXBl9SJCtr9McnkUeXD1k3mZMHSdLmjMBxPjYh5FeZ sfJG8UzcAG5BiDDB7e4ifurbijdZUqGYwc4oWDDglGtU1v7GzSiiUASGa/nAajs8I/Gk FBhrfW6qxFAYLyPt6GsiwCb89bz/kMkiv2y6HGSkKqItUmA8JkBw+9L/RYIdGKYG3yrd pLrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709313239; x=1709918039; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4cT+4J66xoUI7WOzbMtsmkCGWlaImmwZf4sSiT2gD0E=; b=ZEuEcJlWJwW7VmgEJdUp09SUFGysyCuA0J71wTrKtvwi/p0SBUSUPHxhZ+Wr1XubIv DO/7BT7l0CASXiY6dtog8344ybcrnC8T9j/oiwDFJ3nnlpoi+BirIFnNCfNRVaKqxQR0 Iq4NueKEGKouQHOToWpekLCbwOOYet0UXeCYDbjp4tFT6kQObKHE6PrpkNCseX1AuCpO MThds1AEnvb1rDY4S7qZHr6w09FNdmg+6B7R7uE3Ka/dpqQ9Syylg2cUryeIOFI3WsEt ojDU/NkfXLKx+1VzoOBHjbQMmjP6SnRC3V1DQzLBFrDz6CcnKoW7KVzTCgXlGuWcybJC QKiQ== X-Forwarded-Encrypted: i=1; AJvYcCWFpB9FVvixaldiZIMfYZoq2G5ImMQrZx1Z1qt8nFRL9YN1VQQ5J844cOfHGZlrg1qJvQCM3n6k4S4fcakKQnD1Sf/QmJRGVuPmD2xDt7mHY9wp X-Gm-Message-State: AOJu0YwiaCUMthytHmp8qu0VvSUrEaffZ/f8ZORJnWI83cEP9neIZ//k dqFZ6c5AC3UJAVR95Bh6+WJHsej7V/PbcpjvXOIHmYJRCGXejzQB X-Google-Smtp-Source: AGHT+IGlSQv5uIic8fGBYr/PpEYUhCl3PCOyyPL72eKot5yR64VNZVw08waieOzkm3O3x7r8jIUZtw== X-Received: by 2002:a0d:dc41:0:b0:609:6f02:5c18 with SMTP id f62-20020a0ddc41000000b006096f025c18mr2315294ywe.24.1709313239480; Fri, 01 Mar 2024 09:13:59 -0800 (PST) Received: from nathanxps13 (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id a67-20020a0dd846000000b005ff9bb7fa40sm1052783ywe.34.2024.03.01.09.13.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 09:13:59 -0800 (PST) Date: Fri, 1 Mar 2024 11:13:57 -0600 From: Nathan Bossart To: Corey Huinker Cc: Stephen Frost , Ashutosh Bapat , Peter Smith , Tomas Vondra , pgsql-hackers@lists.postgresql.org Subject: Re: Statistics Import and Export Message-ID: <20240301171357.GA3009259@nathanxps13> References: <6b942362-cd19-4e1c-b6da-f230c3f3d9a1@enterprisedb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Feb 29, 2024 at 10:55:20PM -0500, Corey Huinker wrote: >> That’s certainly a fair point and my initial reaction (which could >> certainly be wrong) is that it’s unlikely to be an issue- but also, if you >> feel you could make it work with an array and passing all the attribute >> info in with one call, which I suspect would be possible but just a bit >> more complex to build, then sure, go for it. If it ends up being overly >> unwieldy then perhaps the per-attribute call would be better and we could >> perhaps acquire the lock before the function calls..? Doing a check to see >> if we have already locked it would be cheaper than trying to acquire a new >> lock, I’m fairly sure. > > Well the do_analyze() code was already ok with acquiring the lock once for > non-inherited stats and again for inherited stats, so the locks were > already not the end of the world. However, that's at most a 2x of the > locking required, and this would natts * x, quite a bit more. Having the > procedures check for a pre-existing lock seems like a good compromise. I think this is a reasonable starting point. If the benchmarks show that the locking is a problem, we can reevaluate, but otherwise IMHO we should try to keep it as simple/flexible as possible. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com