From: Luckys <plpgsql@gmail.com>
To: Sriram Dandapani <sdandapani@counterpane.com>
Cc: Pgsql-Performance (E-mail) <pgsql-performance@postgresql.org>
Subject: Re: slow cursor
Date: Tue, 18 Apr 2006 08:55:08 +0400
Message-ID: <b80d582c0604172155n232fba1eybd3cc3f89ec0db5f@mail.gmail.com> (raw)
In-Reply-To: <6992E470F12A444BB787B5C937B9D4DF0406A546@ca-mail1.cis.local>
References: <6992E470F12A444BB787B5C937B9D4DF0406A546@ca-mail1.cis.local>
This is one thing that I always try to avoid, a single INSERT INTO...SELECT
...FROM or single UPDATE is always faster compared to looping the same
within a cursor, unless its inevitable.
regards,
Luckys.
On 4/17/06, Sriram Dandapani <sdandapani@counterpane.com> wrote:
>
> Hi
>
>
>
> I have a cursor that fetches 150K rows and updates or inserts a table with
> 150K rows.
>
>
>
> It takes several minutes for the process to complete (about 15 minutes).
> The select by itself (without cursor) gets all rows in 15 seconds.
>
>
>
> Is there a way to optimize the cursor to fetch all records and speed up
> the process. I still need to do the record by record processing
>
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: plpgsql@gmail.com, sdandapani@counterpane.com
Subject: Re: slow cursor
In-Reply-To: <b80d582c0604172155n232fba1eybd3cc3f89ec0db5f@mail.gmail.com>
* 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