Search Postgresql Archives

Re: Function with limit and offset - PostgreSQL 9.3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/8/2017 5:53 PM, marcinha rocha wrote:
Hi guys! I have the following queries, which will basically select data, insert it onto a new table and update a column on the original table.


I'm sure your example is a gross simplification of what you're really doing, but if that's really all you're doing, why not do it all at once, instead of row at a time?


BEGIN;
    insert into tableb (id) select id from tablea;
    update tablea set migrated=true;
COMMIT;


thats far more efficient that the row-at-a-time iterative solution you showed.

--
john r pierce, recycling bits in santa cruz



--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux