I wondered why they were doing it that way, and if it might be easier to read if it was just:SELECT a,b,c INTO foo.x, foo,y, foo.z;
Now, these aren't quite the same, especially if foo has more than three fields. But even that could be got around.foo := (a,b,c);
But before I tried this out I decided to see how they performed. Here's what happened:
andrew=# do $x$ declare r abc; begin for i in 1 .. 10000000 loop select 'a','b',i into r.x,r.y,r.z; end loop; end; $x$; DO Time: 63731.434 ms
That's a very big difference! Direct assignment takes less than 30% of the time that SELECT INTO takes.andrew=# do $x$ declare r abc; begin for i in 1 .. 10000000 loop r := ('a','b',i); end loop; end; $x$; DO Time: 18744.151 ms
I'm going to dig into why this happens, but meanwhile, I have quite a lot of low hanging performance fruit to pick as a result of this.