Hi, Daniil Davydov. Thanks for sharing your patch!
It was quite a while since I last looked at the patch. I've tested it again, and still get regression on patched version where a table has many columns. And it is totally CPU-bounded on tts_virtual_copyslot. Unpatched version: 1 col: Time: 8909.714 ms (00:08.910) Time: 8803.579 ms (00:08.804) Time: 8600.415 ms (00:08.600) 32 cols: Time: 12911.699 ms (00:12.912) Time: 13543.491 ms (00:13.543) Time: 13325.368 ms (00:13.325) Patched version: 1 col: Time: 3532.841 ms (00:03.533) Time: 3598.223 ms (00:03.598) Time: 3515.858 ms (00:03.516) 32 cols: Time: 35647.724 ms (00:35.648) Time: 35596.233 ms (00:35.596) Time: 35669.106 ms (00:35.669) I've tested your patch with tuplestore and found the regression does not exist anymore, but I haven't look deep inside it. Patched version (with tuplestore): 1 col: Time: 3500.502 ms (00:03.501) Time: 3486.886 ms (00:03.487) Time: 3514.233 ms (00:03.514) 32 cols: Time: 10375.391 ms (00:10.375) Time: 10248.256 ms (00:10.248) Time: 10248.289 ms (00:10.248) It seems to be a good idea if there is no other issue with your patch. -- Regards, Jingtang