Re: Update command too slow - Mailing list pgsql-general

From Tom Lane
Subject Re: Update command too slow
Date
Msg-id 23614.1107622620@sss.pgh.pa.us
Whole thread Raw
In response to Re: Update command too slow  (Venkatesh Babu <venkatbabukr@yahoo.com>)
Responses Re: Update command too slow
List pgsql-general
Venkatesh Babu <venkatbabukr@yahoo.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

pgsql-general by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: pgpool simple feature request
Next
From: Jan Wieck
Date:
Subject: Re: Is there a peer-to-peer server solution with PG?