On Mon, Nov 23, 2026 at 6:14 PM Maxim Orlov <[email protected]> wrote:

> Hi!
>
> I want to say right away that I like the idea behind the patch.
>
> One area I noticed is in transformInsertSetClause. This call uses nested
> loops to construct lists. In a synthetic test case with a thousand
> columns and many records, the patch performs significantly slower than
> a standard INSERT. It might be possible to use a hash table to speed up
> lookups in this scenario. On the other hand, that would also make the
> code a bit more complicated.
>
> I don’t consider this a flaw of some sort, that should hold up
> development or committing the code—it’s simply a characteristic worth
> being aware of.
>
>
Thank you for the review.

Following your suggestion, I implemented the hash table approach in
transformInsertSetClause, and it does turn out to be faster.  Since this
is the INSERT path, I think performance is important here.
Please find attached the v8 patch that implements the hash table approach.

I have also performed a quick perforamnce test for the same and I
can see good amount of improvement if we have large number of columns.
These numbers are in milliseconds.

rows x columns            v7 (list scan)    v8 (hash table)
---------------------            --------------         ---------------
10 rows x 10 cols                0.06                 0.06
1000 rows x 10 cols            2.38                 2.26
100 rows x 100 cols            4.25                 2.15
1000 rows x 100 cols          43.5                 22.4
10 rows x 1000 cols            28.9                 3.69
100 rows x 1000 cols          274.9               24.5
1000 rows x 1000 cols        2789                236.7

Please let me know your thoughts on the same.
--

Thanks & Regards,
Suraj kharage,



enterprisedb.com <https://www.enterprisedb.com/>

Attachment: v8-0001-Add-support-for-INSERT-.-SET-syntax.patch
Description: Binary data

Reply via email to