Re: Use ctid in where clause in update from statement

Поиск
Список
Период
Сортировка
От Dirk Mika
Тема Re: Use ctid in where clause in update from statement
Дата
Msg-id 209A99DE-CF4F-47E4-BBDF-530112814475@mikatiming.de
обсуждение исходный текст
Ответ на Re: Use ctid in where clause in update from statement  (Thomas Kellerer <spam_eater@gmx.net>)
Ответы Re: Use ctid in where clause in update from statement  (Thomas Kellerer <spam_eater@gmx.net>)
Re: Use ctid in where clause in update from statement  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
I know I can join using the pk, but in oracle using the rowid is faster so I wanted to know, if this is possible in
PostgreSQLas well.
 

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



## How2Use
## the ChampionChip by mika:timing
## https://youtu.be/qfOFXrpSKLQ
Am 01.07.19, 11:36 schrieb "Thomas Kellerer" <spam_eater@gmx.net>:

    > I come from the Oracle world and am trying to convert some queries to
    > PostgreSQL syntax. One of these queries is a MERGE statement, which I
    > converted into an UPDATE SET FROM WHERE construct. In the original
    > query I use the pseudo column ROWID to match a source row with a
    > target row.
    >
    > In the PostgreSQL version I use the column ctid for this. The above query becomes:
    >
    > *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;

    Why don't you join on the primary key column?
    The ctid comparison is typically quite slow.

    Thomas





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

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