Re: Update command too slow

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Venkatesh Babu <venkatbabukr(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Update command too slow
Date: 2005-02-05 16:57:00
Message-ID: 23614.1107622620@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Venkatesh Babu <venkatbabukr(at)yahoo(dot)com> writes:
> There aren't any triggers but there are 75262 update
> statements. The problem is that we have a datatype
> called as "Collection" and we are fetching the data
> rows into it, modifying the data and call
> Collection.save(). This save method generates one
> update satement per record present in it.

Well, that's going to be dog-slow in any case compared to putting the
logic on the server side, but a couple of things you could possibly
do: make sure all of this is in one transaction block (a commit per
row updated is a lot of overhead) and use a prepared statement for the
UPDATE to get you out from under the repeated parse/plan overhead.
Check the UPDATE's plan, too, and make sure it's an indexscan on the
primary key rather than anything less efficient.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jan Wieck 2005-02-05 20:03:52 Re: Is there a peer-to-peer server solution with PG?
Previous Message Joshua D. Drake 2005-02-05 16:08:13 pgpool simple feature request