optimizing simple math operator

From: "Ryan D(dot) E nos" <renos(at)ucla(dot)edu>
To: pgsql-novice(at)postgresql(dot)org
Subject: optimizing simple math operator
Date: 2008-05-09 17:11:03
Message-ID: 482485A7.5020305@ucla.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi,
I am an extreme postgres novice. I occasionally use databases to handle
large voter lists.

I am running postgres on a Windows XP platform on a machine with
Pentium(R) 4 CPU 3 GHz and 1GB of RAM.

I have a table with approximately 4 million rows that I am trying to
update a single numeric column of with the following math operation
using two integer columns:

update test
set turnout1_cityblock = cityblock_election8/cityblock_regpop;

on the test table with approximately 45K rows, that update takes only
about 4 seconds. I have also tried casting the integers as numeric and
that increases the update time to only about 10 seconds.

However, with the full table of 4 million rows, the update takes an
unreasonable amount of time (I'm talking days). There are no nulls in
either column in the larger table.

Can anybody help me figure out why there is the inefficiency with the
update in the large table?

thanks.
Ryan

Browse pgsql-novice by date

  From Date Subject
Next Message Cliff Nieuwenhuis 2008-05-10 14:19:52 Re: [NOVICE] encoding problems
Previous Message Guido Barosio 2008-05-09 16:58:40 Re: Is there a trace facility for postgres/php?