Skip site navigation (1) Skip section navigation (2)

Re: Replacing Cursors with Temporary Tables

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>
Cc: Eliot Gable <egable+pgsql-performance(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Replacing Cursors with Temporary Tables
Date: 2010-04-24 15:20:12
Message-ID: (view raw or whole thread)
Lists: pgsql-performance
2010/4/24 Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>:
> On Sat, Apr 24, 2010 at 2:23 PM, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
>> Well, you missed the most important part: not using cursors at all.
>> Instead of declaring a cursor and looping it to build the array, build
>> it with array().  That's what I've been saying: arrays can completely
>> displace both temp tables _and_ cursors when passing small sets around
>> functions.
> with huge emphasis on the word small.

The rule of thumb I use is 10000 narrow records (scalars, or very
small composites) or 1000 wide/complex records.  I routinely pass
extremely complex (3-4 levels nesting) nested composite arrays to the
client for processing -- it is extremely efficient and clean.  This of
course is going to depend on hardware and other factors.


In response to

pgsql-performance by date

Next:From: Коротков АлександрDate: 2010-04-25 18:22:29
Subject: Planner issue on sorting joining of two tables with limit
Previous:From: Grzegorz JaśkiewiczDate: 2010-04-24 14:38:02
Subject: Re: Replacing Cursors with Temporary Tables

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group