Introduce join_info_array for direct lookups of SpecialJoinInfo by ojrelid

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Introduce join_info_array for direct lookups of SpecialJoinInfo by ojrelid
Date: 2023-05-04 08:07:10
Message-ID: CAMbWs4_EyKimsqkkBAddEW8n1YyPjQd4gmnwYqqHHAUjKkBVQw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

When working on the improper qual pushdown issue [1], there is a need in
the proposed fix to avoid scanning all the SpecialJoinInfos, since that
is too expensive. I think this might be a common requirement. In the
current codes there are several places where we need to scan all the
SpecialJoinInfos in join_info_list looking for SpecialJoinInfos that
belong to a given outer join relid set, which is an O(n) operation. So
start a new thread for this requirement.

To improve the O(n) operation, introduce join_info_array to allow direct
lookups of SpecialJoinInfo by ojrelid. This is doable because for each
non-zero ojrelid there can only be one SpecialJoinInfo. This can
benefit clause_is_computable_at() and have_unsafe_outer_join_ref(), as
the patch does, and more future usages such as
add_outer_joins_to_relids() in the proposed patch for issue [1].

[1]
https://www.postgresql.org/message-id/flat/0b819232-4b50-f245-1c7d-c8c61bf41827%40postgrespro.ru

Thanks
Richard

Attachment Content-Type Size
v1-0001-Allow-direct-lookups-of-SpecialJoinInfo-by-ojrelid.patch application/octet-stream 7.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Anton Kirilov 2023-05-04 09:21:56 Re: Add PQsendSyncMessage() to libpq
Previous Message Anton A. Melnikov 2023-05-04 07:22:36 Re: Making Vars outer-join aware