Re: slow cursor

From: Luckys <plpgsql(at)gmail(dot)com>
To: "Sriram Dandapani" <sdandapani(at)counterpane(dot)com>
Cc: "Pgsql-Performance (E-mail)" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: slow cursor
Date: 2006-04-18 04:55:08
Message-ID: b80d582c0604172155n232fba1eybd3cc3f89ec0db5f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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(at)counterpane(dot)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
>

In response to

  • slow cursor at 2006-04-17 14:34:38 from Sriram Dandapani

Browse pgsql-performance by date

  From Date Subject
Next Message Gavin Hamill 2006-04-18 08:07:40 Re: Slow query - possible bug?
Previous Message Sriram Dandapani 2006-04-17 20:05:17 Re: creating of temporary table takes very long