Search Postgresql Archives

which Update quicker

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

 



Hello list,

For a big table with more than 1,000,000 records, may I know which update is quicker please?

(1) update t1
      set c1 = a.c1
      from a
      where pk and
                 t1.c1       <> a.c1;
 ......
      update t1
      set c_N = a.c_N
      from a
      where pk and
                 t1.c_N       <> a.c_N;


(2)  update t1
      set c1 = a.c1 ,
            c2  = a.c2,
            ...
            c_N = a.c_N
     from a
     where pk AND
               (  t1.c1 <> a.c1 OR t1.c2 <> a.c2..... t1.c_N <> a.c_N)


Or other quicker way for update action?

Thank you
Emi




--
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