Re: Updating a very large table

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

 



Chris Browne <cbbrowne@xxxxxxx> wrote: 
 
> I'd suggest adding an index
 
The OP said the table had 15 indexes already.  I would guess one of
those could be used.  Perhaps it has a primary key....
 
>   update table1 set new_column = [whatever calculation]
>   where new_column is null and
>         quasi_unique_column in
>           (select quasi_unique_column from table1
>            where new_column is null limit 1000);
 
Or, if the primary key (or other unique or quasi-unique existing
index) has multiple columns, this could still be done with:
 
  update table1 set new_column = [whatever calculation]
  where new_column is null and
        (col1, col2) in
          (select col1, col2 from table1
           where new_column is null limit 1000);
 
-Kevin

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

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux