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 1tDG6w-00H5jU-JS for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Nov 2024 04:45:10 +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 1tDG6t-00ALdI-JC for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Nov 2024 04:45:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tDG6t-00ALd9-9i for pgsql-hackers@lists.postgresql.org; Tue, 19 Nov 2024 04:45:07 +0000 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tDG6q-002dFu-SU for pgsql-hackers@postgresql.org; Tue, 19 Nov 2024 04:45:06 +0000 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-53d8c08cfc4so2678822e87.3 for ; Mon, 18 Nov 2024 20:45:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731991503; x=1732596303; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=zYvtQUr9xvbX5gBZW4tnal6Ic8B5dtHLU5DsdekH8mo=; b=SRkh+TRj7jG35O1v0dcZo60yz7ko0Lf9N7MbMP82fKVA9T5YL8ky8wAO77wIm/lCOq RTnOTOIQTEjX9x0b92NpvgLo1kNGsyr8hmmQL77B5LofzrvoDmxL1g2IJHjSDdv/Dohi X3DiG7wIZECnV9j5VTjXZVjtxUEmoCEkjGqqdIil5+witKUw0FhHllQIN7zjVBd1ybyZ oV8OWrcbXymnsr6kWef4QqAuo5sEVgsdQsfo/3/+PXjOkoj3ehTlEK1MAbNYiRT/Re6m 14j9ui3GEWgOc7iseHIFTzJHGt2bYaYW0JKShnIleXepetCRupm5fiOvJJGLFqU7wEYZ 5+RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731991503; x=1732596303; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zYvtQUr9xvbX5gBZW4tnal6Ic8B5dtHLU5DsdekH8mo=; b=DmdGBKtoVCKaJxam4ZsarwoszSASKGJl9V1aUygOUF7B+HMU/JyBIWSiFmAUxkl/FQ heiTaeYwH4ryIyISiIS1EzO6FdpYVWbHQFZG3o1RgwFa4maXbpDyzQdrpfulAIQffHT+ FlfjER4OMJAS/MFau3jJ+5Bk9Ge6sw36Dq25j7MD5lFJPW5OHb5AaquMT2pufui7ZYXA +nJdagickG+h3vK9oQ21DpooQ+rqvTDauS9FeO6Z9vM9IIiIxhTnNHITk4qP0zX0nUK7 Az2+9i5mezLjjZ3hPExtxwZA8YlJR0seFcvKO5HBEfqWIjLUgO8hNSTYDP+JzAiW3EkD AiSQ== X-Forwarded-Encrypted: i=1; AJvYcCWB75sadTi2w0MeuH88XMCCfD6LZQtgthAJdPLOxmwnVQgOwiHfOuVA8eY7+loLgWTLQfJlkxvyM3I+3YnV@postgresql.org X-Gm-Message-State: AOJu0YyBId7HqvJF/QjzgzEm4UmYIPKmXnGX8n3gszxgIhdL4Y7xVTqA Yj5ZnNp3h7UoLypba83g2iQaiAZiMq8A8VV0j+WnQzXI82J5zK4C6Nw9/TqrGKOSOWbtwYAatWg MALdPRUmWAfoVoRHdfIE0o9/jnsB7og== X-Google-Smtp-Source: AGHT+IGtukN6AnRcqo8zVhThaN0B/x2tfeLhtfRpbcveGoNph3XHMu7UOue/sNV/La9RfGXVu3wetu97WFAzaYZcUHk= X-Received: by 2002:ac2:568d:0:b0:53d:a8b6:dd87 with SMTP id 2adb3069b0e04-53dab29bb36mr5812208e87.15.1731991502756; Mon, 18 Nov 2024 20:45:02 -0800 (PST) MIME-Version: 1.0 References: <20241114.161948.1677325020727842666.kou@clear-code.com> <20241119.103115.418773618386970482.kou@clear-code.com> In-Reply-To: <20241119.103115.418773618386970482.kou@clear-code.com> From: Masahiko Sawada Date: Mon, 18 Nov 2024 20:44:25 -0800 Message-ID: Subject: Re: Make COPY format extendable: Extract COPY TO format implementations To: Sutou Kouhei Cc: michael@paquier.xyz, pgsql-hackers@postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Nov 18, 2024 at 5:31=E2=80=AFPM Sutou Kouhei w= rote: > > Hi, > > In > "Re: Make COPY format extendable: Extract COPY TO format implementation= s" on Mon, 18 Nov 2024 17:02:41 -0800, > Masahiko Sawada wrote: > > > I have a question about v22. We use pg_attribute_always_inline for > > some functions to avoid function call overheads. Applying it to > > CopyToTextLikeOneRow() and CopyFromTextLikeOneRow() are legitimate as > > we've discussed. But there are more function where the patch applied > > it to: > > > > -bool > > -NextCopyFromRawFields(CopyFromState cstate, char ***fields, int *nfiel= ds) > > +static pg_attribute_always_inline bool > > +NextCopyFromRawFields(CopyFromState cstate, char ***fields, int > > *nfields, bool is_csv) > > > > -static bool > > -CopyReadLineText(CopyFromState cstate) > > +static pg_attribute_always_inline bool > > +CopyReadLineText(CopyFromState cstate, bool is_csv) > > > > +static pg_attribute_always_inline void > > +CopyToTextLikeSendEndOfRow(CopyToState cstate) > > > > I think it's out of scope of this patch even if these changes are > > legitimate. Is there any reason for these changes? > > Yes for NextCopyFromRawFields() and CopyReadLineText(). > No for CopyToTextLikeSendEndOfRow(). > > NextCopyFromRawFields() and CopyReadLineText() have "bool > is_csv". So I think that we should use > pg_attribute_always_inline (or inline) like > CopyToTextLikeOneRow() and CopyFromTextLikeOneRow(). I think > that it's not out of scope of this patch because it's a part > of CopyToTextLikeOneRow() and CopyFromTextLikeOneRow() > optimization. > > Note: The optimization is based on "bool is_csv" parameter > and constant "true"/"false" argument function call. If we > can inline this function call, all "if (is_csv)" checks in > the function are removed. Understood, thank you for pointing this out. > > pg_attribute_always_inline (or inline) for > CopyToTextLikeSendEndOfRow() is out of scope of this > patch. You're right. > > I think that inlining CopyToTextLikeSendEndOfRow() is better > because it's called per row. But it's not related to the > optimization. > > > Should I create a new patch set without > pg_attribute_always_inline/inline for > CopyToTextLikeSendEndOfRow()? Or could you remove it when > you push? Since I'm reviewing the patch and the patch organization I'll include it. Regards, --=20 Masahiko Sawada Amazon Web Services: https://aws.amazon.com