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 1tnsjc-003B1t-Hw for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Feb 2025 05:16:29 +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 1tnsjd-00E9Mz-L5 for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Feb 2025 05:16:28 +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 1tnsjd-00E9Me-Ad for pgsql-hackers@lists.postgresql.org; Fri, 28 Feb 2025 05:16:27 +0000 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tnsjY-00071h-0B for pgsql-hackers@postgresql.org; Fri, 28 Feb 2025 05:16:27 +0000 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4399deda4bfso11178985e9.0 for ; Thu, 27 Feb 2025 21:16:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740719784; x=1741324584; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=m3rZ7I/yC/HCFGrqZ/MA2x5h52PWEk/pPtklkj6fOcc=; b=fNlRWVH83U3Ats6v4TWwQos9ckGMkBFTOQKEu9WfCI343LSxZZrG6wYnpISWceQxSr nHPdBxNAONh3PcPY60rHMP3Ov4BsA+gHY8YgVvpyGBR7nBqU0S1LYhZAC3xm1ufgnB06 R52U9lsNKNhSv+5M4UX8yGBk5hD2BiV5vPkHixEZfF3hU3p+3GuQoJYuU5OKeiTRKodd fVyaikYAjDae6zsDbPfVE8f8/CKmTTX46FbZYkq1Tsxi50r/h2C6X+krkGpTvTnVYy+n gwQrLIrN8kNvIUnv6nWRW6SnfCnuBK0uzgVztbN9+6Sy/Hjm275VPSW4hZp1+RdTSZMn 2N4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740719784; x=1741324584; h=in-reply-to: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=m3rZ7I/yC/HCFGrqZ/MA2x5h52PWEk/pPtklkj6fOcc=; b=BtyinjLO09We6NFve4mxBP2m12VoiB12kUFaaA4+1zdv8RxbnPTYpJS8ImtN7GjMDn zOYwdrooPR1DlXxKIrYJrNDsfZXLcpr0TuBYLp0GzIZOwsw9gZm7NFVYCFP+otaVA/Fd /EVlwXNyUhC7u9F9VMfGjUrOMMkUGr6LW4d87E9LPu+9qBibg1SRCNco8yxRIM/W4qIx yl+HogRyJjQnamXbFoC05J66QfsWmVAK1Sy65gjZydtQokmHnOvskh7m5nxs6ujWIDjK xm+zKRdnp7gDxqq/DySHfsj9JjAelOMU5rdnggqJaEN2k/g7DbuWvtKUH9esgfKilVum qmJA== X-Forwarded-Encrypted: i=1; AJvYcCUNWQ7bl5wqnGubx8dXKXonNsHvzlNDk6lELUzvgICF6rb4jW+j7RJdxEBplb2BjukdMykMY17u7RzdClPI@postgresql.org X-Gm-Message-State: AOJu0Yw/DsIkJ/UceVRhjnShBC/GucFhcFqD3oq7YHffEkh8aVlhnyTB Ym5SMKjQ5iYH5vZRQ1UwqWyep0f1VRTDnrMp3SnUy+/fvDWnX5P1 X-Gm-Gg: ASbGncvbzwituxFSWn7l90wzI5we9X8SynJ8I2NlzAeCjXpysueItIUsFq9DBspmhXZ XJCPRKwrtEl4kpayCZg5rvkJoJtT+iuxM44kH3ME8Xfb/icJ2JpU/Mpxv5Lb1dQ3Vu+utP0ylni lU4AG7x45wd0j3BClYsRDFR5jWTDf8CRIIVoq7KlOfCVSVtKe3igYqrGrMhA7Np+PPuAzjZVOJl 5xIFlms643t5pCn1VSMg0G5+DtiZ9qKbGiPHsOVjrPIJXt2V0/oSdXz9jnNEsU1nrkMtFwtvOMy 9f+4qFmUkkyICYoycUX8mIqeD933oFvwpBMXia8kXXJBaGOVUJ3fiGSfmC2QDYZKFYRmfnkyD3V 32BnSiBullF/r2vz+mTPRdD1VPp7cbq37zNTQttC54heU+0/8C/fsiXJwWQ== X-Google-Smtp-Source: AGHT+IESppr8rNW7JVx1HJtEvn6+XcDFFysPJVBfXNCwRLV2S2ZLD32kbLKuWB0rOPKVU2jF9qQ6Kw== X-Received: by 2002:a05:600c:1384:b0:439:9192:f088 with SMTP id 5b1f17b1804b1-43ba66e6f80mr13481365e9.8.1740719783971; Thu, 27 Feb 2025 21:16:23 -0800 (PST) Received: from ip-10-97-1-34.eu-west-3.compute.internal (ec2-15-237-181-182.eu-west-3.compute.amazonaws.com. [15.237.181.182]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43aba52b88asm75682755e9.4.2025.02.27.21.16.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 21:16:23 -0800 (PST) Date: Fri, 28 Feb 2025 05:16:21 +0000 From: Bertrand Drouvot To: Melanie Plageman Cc: Fujii Masao , Guillaume Lelarge , Pg Hackers , Daniel Gustafsson , andrey.chudnovskiy@microsoft.com, Jelte Fennema-Nio , Jacob Champion Subject: Re: Log connection establishment timings Message-ID: References: <65fe2d68-a214-40f0-80a8-56ca7323ad5c@oss.nttdata.com> 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 Hi, On Thu, Feb 27, 2025 at 11:08:04AM -0500, Melanie Plageman wrote: > I was just talking to Andres off-list and he mentioned that the volume > of log_connections messages added in recent releases can really be a > problem for users. He said ideally we would emit one message which > consolidated these (and make sure we did so for failed connections too > detailing the successfully completed stages). > > However, since that is a bigger project (with more refactoring, etc), > he suggested that we change log_connections to a GUC_LIST > (ConfigureNamesString) with options like "none", "received, > "authenticated", "authorized", "all". > > Then we could add one like "established" for the final message and > timings my patch set adds. I think the overhead of an additional log > message being emitted probably outweighs the overhead of taking those > additional timings. > > String GUCs are a lot more work than enum GUCs, so I was thinking if > there is a way to do it as an enum. > > I think we want the user to be able to specify a list of all the log > messages they want included, not just have each one include the > previous ones. So, then it probably has to be a list right? There is > no good design that would fit as an enum. Interesting idea... Yeah, that would sound weird with an enum. I could think about providing an enum per possible combination but I think that would generate things like 2^N enum and won't be really user friendly (also that would double each time we'd want to add a new possible "value" becoming quickly unmanageable). So yeah, I can't think of anything better than GUC_LIST. > > I think that's somehow also around code maintenance (not only LOC), say for example > > if we want to add more "child_type" in the check (no need to remember to update both > > locations). > > I didn't include checking the child_type in that function since it is > unrelated to instr_time, so it sadly wouldn't help with that. We could > macro-ize the child_type check were we to add another child_type. Yup but my idea was to put all those line: " if (Log_connections && (child_type == B_BACKEND || child_type == B_WAL_SENDER)) { instr_time fork_time = ((BackendStartupData *) startup_data)->fork_time; conn_timing.fork_duration = INSTR_TIME_GET_DURATION_SINCE(fork_time); } " into a dedicated helper function. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com