Re: Use ctid in where clause in update from statement

Поиск
Список
Период
Сортировка
От Dirk Mika
Тема Re: Use ctid in where clause in update from statement
Дата
Msg-id 72E4F35D-9AE9-4570-97F3-450B8617CD2B@mikatiming.de
обсуждение исходный текст
Ответ на Re: Use ctid in where clause in update from statement  (Achilleas Mantzios <achill@matrix.gatewaynet.com>)
Список pgsql-general

This is just a very simplified sample and doesn’t makes sense, but it shows the execution plan. The original query is more complex.  It selects more values and updates more columns.

 

Dirk

 

--
Dirk Mika
Software Developer



mika:timing GmbH
Strundepark - Kürtener Str. 11b
51465 Bergisch Gladbach
Germany

fon +49 2202 2401-1197
dirk.mika@mikatiming.de
www.mikatiming.de

AG Köln HRB 47509 * WEEE-Reg.-Nr. DE 90029884
Geschäftsführer: Harald Mika, Jörg Mika


 

Von: Achilleas Mantzios <achill@matrix.gatewaynet.com>
Datum: Montag, 1. Juli 2019 um 11:50
An: "pgsql-general@lists.postgresql.org" <pgsql-general@lists.postgresql.org>
Betreff: Re: Use ctid in where clause in update from statement

 

On 1/7/19 12:13 μ.μ., Dirk Mika wrote:

 

UPDATE test_large d

   SET grp = s.grp

  FROM (SELECT ctid, test_large.*

          FROM test_large

         WHERE grp = 1) s

 WHERE d.ctid = s.ctid;

 


Besides, what the above does is select for rows that have grp=1 and then set grp to the same value.


 

BR

Dirk

 

--
Dirk Mika
Software Developer

cid:part1.F9658A75.C84DBA7E@matrix.gatewaynet.com

mika:timing GmbH

Strundepark - Kürtener Str. 11b
51465 Bergisch Gladbach
Germany

fon +49 2202 2401-1197
dirk.mika@mikatiming.de
www.mikatiming.de

AG Köln HRB 47509 * WEEE-Reg.-Nr. DE 90029884
Geschäftsführer: Harald Mika, Jörg Mika

 

cid:part2.3A5504AA.38B3DF7A@matrix.gatewaynet.com


 




-- 
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt
Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Dirk Mika
Дата:
Сообщение: Re: Use ctid in where clause in update from statement
Следующее
От: Dirk Mika
Дата:
Сообщение: Re: Use ctid in where clause in update from statement