Re: assignment vs SELECT INTO

От: Tom Lane
Тема: Re: assignment vs SELECT INTO
Дата: ,
Msg-id: 25915.1415046245@sss.pgh.pa.us
(см: обсуждение, исходный текст)
Ответ на: assignment vs SELECT INTO  (Andrew Dunstan)
Ответы: Re: assignment vs SELECT INTO  (Andrew Dunstan)
Список: pgsql-performance

Скрыть дерево обсуждения

assignment vs SELECT INTO  (Andrew Dunstan, )
 Re: assignment vs SELECT INTO  (Tom Lane, )
  Re: assignment vs SELECT INTO  (Andrew Dunstan, )
 Re: assignment vs SELECT INTO  (Matheus de Oliveira, )

Andrew Dunstan <> writes:
>     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
>     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

> Is it simply because the SELECT is in effect three assignments, so it
> takes nearly 3 times as long?

I think it's more likely that the second example is treated as a "simple
expression" so it has less overhead than a SELECT.

            regards, tom lane



В списке pgsql-performance по дате сообщения:

От: Andrew Dunstan
Дата:
Сообщение: Re: assignment vs SELECT INTO
От: Stuart Bishop
Дата:
Сообщение: Re: Replication Lag Causes