public inbox for [email protected]
help / color / mirror / Atom feedFrom: Dong Wook Lee <[email protected]>
To: Ranier Vilela <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] Improve function toast_delete_external (src/backend/access/table/toast_helper.c)
Date: Wed, 9 Feb 2022 23:33:47 +0900
Message-ID: <CAAcByaJK_ivH2555T2kwDa4h67eh+U8eXTRctp_OjodmFyctXw@mail.gmail.com> (raw)
In-Reply-To: <CAEudQApq+wJJyFHQ9iYGrd2vUK+Uk1i214KsBewe7nkvcWYBaQ@mail.gmail.com>
References: <CAEudQApq+wJJyFHQ9iYGrd2vUK+Uk1i214KsBewe7nkvcWYBaQ@mail.gmail.com>
Hi,
I've applied your patch. I think it's reasonable.
but IMHO It looks more complicated to read because of many conditions
in if statement.
so what about just moving up if-statement?
Thanks.
Dong Wook Lee
2022년 2월 9일 (수) 오후 7:56, Ranier Vilela <[email protected]>님이 작성:
>
> Hi,
>
> I think this change can improve this particular function by avoiding touching value if not needed.
> Test if not isnull is cheaper than test TupleDescAttr is -1.
>
> best regards,
>
> Ranier Vilela
Attachments:
[application/octet-stream] v2_tiny_improvemnt_toast_helper.patch (591B, ../CAAcByaJK_ivH2555T2kwDa4h67eh+U8eXTRctp_OjodmFyctXw@mail.gmail.com/2-v2_tiny_improvemnt_toast_helper.patch)
download | inline diff:
diff --git a/src/backend/access/table/toast_helper.c b/src/backend/access/table/toast_helper.c
index 0cc5a30f9b..c04f9c14d2 100644
--- a/src/backend/access/table/toast_helper.c
+++ b/src/backend/access/table/toast_helper.c
@@ -326,10 +326,11 @@ toast_delete_external(Relation rel, Datum *values, bool *isnull,
{
if (TupleDescAttr(tupleDesc, i)->attlen == -1)
{
- Datum value = values[i];
-
if (isnull[i])
continue;
+
+ Datum value = values[i];
+
else if (VARATT_IS_EXTERNAL_ONDISK(PointerGetDatum(value)))
toast_delete_datum(rel, value, is_speculative);
}
view thread (3+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: [PATCH] Improve function toast_delete_external (src/backend/access/table/toast_helper.c)
In-Reply-To: <CAAcByaJK_ivH2555T2kwDa4h67eh+U8eXTRctp_OjodmFyctXw@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox