From: Jonathan Blitz <jb@anykey.co.il>
To: pgsql-performance@postgresql.org
Subject: Adding and filling new column on big table
Date: Wed, 17 May 2006 03:19:26 +0200
Message-ID: <01b401c6794f$f27355e0$ddf71005@jonathanlaptop> (raw)
I have a table of about 500,000 rows.
I need to add a new column and populate it.
So, I have tried to run the following command. The command never finishes (I
gave up after about and hour and a half!).
Note that none of the columns have indexes.
Update mytable set new_column =
case when column_1 = column_2
then 1
when column_1+column_3= column_2 and column_3 > 0
then 2
when column_1+column_3+column_4 = column_2 and column_4 > 0
then 3
when column_1+column_3+column_4+column_5 = column_2 and column_5 > 0
then 4
else
0
end
My computer is a Pentium 4 2.4 GHZ and 1G RAM so it should be fast
enough.
Any ideas?
Jonathan Blitz
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.6/340 - Release Date: 05/15/2006
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: jb@anykey.co.il
Subject: Re: Adding and filling new column on big table
In-Reply-To: <01b401c6794f$f27355e0$ddf71005@jonathanlaptop>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox