[GRASSLIST:4476] How can I speed this up?

The code is very simple:

for MYCAT in `echo "select distinct avicat from allpoly_att"|db.select
-c`; do
    echo $MYCAT
    AGE=`echo "select age from play_att where link_key = $MYCAT" |
db.select -c`
    COVER=`echo "select cover from play_att where link_key = $MYCAT" |
db.select -c`

    echo "update allpoly_att set age = $AGE where avicat = $MYCAT" |
db.execute
    echo "update allpoly_att set cover = $COVER where avicat = $MYCAT" |
db.execute
done

Right now, it is doing about 2 updates per second - which is too slow!
Is the slowness caused by piping it through db.execute?

Other suggestions for speeding this up?

Cheers!
Craig

The code is very simple:

for MYCAT in `echo "select distinct avicat from
allpoly_att"|db.select
-c`; do
    echo $MYCAT
    AGE=`echo "select age from play_att where link_key = $MYCAT" |
db.select -c`
    COVER=`echo "select cover from play_att where link_key = $MYCAT"
|
db.select -c`

    echo "update allpoly_att set age = $AGE where avicat = $MYCAT" |
db.execute
    echo "update allpoly_att set cover = $COVER where avicat =
$MYCAT" |
db.execute
done

Right now, it is doing about 2 updates per second - which is too
slow!
Is the slowness caused by piping it through db.execute?

Other suggestions for speeding this up?

you might scatter in the "date" unix command in to show a timestamp or
use the "time" command ('time db.execute ...') to profile which command
is the slow link.

Hamish

_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

On Thursday 07 October 2004 00:03, Craig Aumann wrote:

The code is very simple:

for MYCAT in `echo "select distinct avicat from allpoly_att"|db.select
-c`; do
    echo $MYCAT
    AGE=`echo "select age from play_att where link_key = $MYCAT" |
db.select -c`
    COVER=`echo "select cover from play_att where link_key = $MYCAT" |
db.select -c`

    echo "update allpoly_att set age = $AGE where avicat = $MYCAT" |
db.execute
    echo "update allpoly_att set cover = $COVER where avicat = $MYCAT" |
db.execute
done

Right now, it is doing about 2 updates per second - which is too slow!
Is the slowness caused by piping it through db.execute?

Other suggestions for speeding this up?

Postgres + index for link_key and avicat.

Radim