From: | Zhihong Yu <zyu(at)yugabyte(dot)com> |
---|---|
To: | PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Removing unneeded self joins |
Date: | 2022-05-13 22:42:18 |
Message-ID: | CALNJ-vTaTkeY3yc=r8MR7XuqvGUAytP=NdFTtOq-Lh1otKmhNQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
w.r.t. v33-0001-Remove-self-joins.patch :
removes inner join of plane table -> removes inner join of plain table
in an query plan -> in a query plan
+ * Used as the relation_has_unique_index_for,
Since relation_has_unique_index_for() becomes a wrapper of
relation_has_unique_index_ext, the above sentence doesn't make much sense.
I think you can drop this part.
but if extra_clauses doesn't NULL -> If extra_clauses isn't NULL
+ is_req_equal =
+ (rinfo->required_relids == rinfo->clause_relids) ? true : false;
The above can be simplified to:
is_req_equal = rinfo->required_relids == rinfo->clause_relids;
+ ListCell *otherCell;
otherCell should be initialized to NULL.
+ if (bms_is_member(k, info->syn_lefthand) &&
+ !bms_is_member(r, info->syn_lefthand))
+ jinfo_check = false;
+ else if (bms_is_member(k, info->syn_righthand) &&
+ !bms_is_member(r, info->syn_righthand))
+ jinfo_check = false;
+ else if (bms_is_member(r, info->syn_lefthand) &&
+ !bms_is_member(k, info->syn_lefthand))
+ jinfo_check = false;
I think the above code can be simplified:
If bms_is_member(k, info->syn_lefthand) ^ bms_is_member(r,
info->syn_lefthand) is true, jinfo_check is false.
If bms_is_member(k, info->syn_righthand) ^ bms_is_member(r,
info->syn_righthand) is true, jinfo_check is false.
Otherwise jinfo_check is true.
Cheers
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2022-05-13 23:17:45 | Re: [RFC] building postgres with meson -v8 |
Previous Message | Thomas Munro | 2022-05-13 22:25:20 | Re: Backends stunk in wait event IPC/MessageQueueInternal |