pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Merlin Moncure <mmoncure@gmail.com>
To: Grzegorz Jaśkiewicz <gryzman@gmail.com>
Cc: Eliot Gable <egable+pgsql-performance@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Replacing Cursors with Temporary Tables
Date: Sat, 24 Apr 2010 11:20:12 -0400
Message-ID: <y2kb42b73151004240820u5a0082dt2201eef3c4dafa87@mail.gmail.com> (raw )
In-Reply-To: <p2k2f4958ff1004240738i91f8b5eco8b4571f994e15254@mail.gmail.com >
References: <n2ybf6923ed1004211316ib844d82bn7a63bd3292ca80a0@mail.gmail.com >
<n2sb42b73151004220711mc2135db6heccf53ec1fb0136e@mail.gmail.com >
<q2yb42b73151004220742gbb7ae4adyc3781cedf98e8559@mail.gmail.com >
<m2gbf6923ed1004221357ua9ab54a3s92dfdbb59cfef832@mail.gmail.com >
<n2qbf6923ed1004231342l61f766fax8fb2a482aa3b0faf@mail.gmail.com >
<r2wb42b73151004231401r120510e8ne5ece4cdda768d5a@mail.gmail.com >
<x2kbf6923ed1004231739qe92d06c2o557d4e31e66ba3d7@mail.gmail.com >
<v2ybf6923ed1004231931gc02a4368wa00bbc0fdf8d4543@mail.gmail.com >
<s2lb42b73151004240623h78726052h4f30fade77f8b572@mail.gmail.com >
<p2k2f4958ff1004240738i91f8b5eco8b4571f994e15254@mail.gmail.com >
2010/4/24 Grzegorz Jaśkiewicz <gryzman@gmail.com>:
>
>
> On Sat, Apr 24, 2010 at 2:23 PM, Merlin Moncure <mmoncure@gmail.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.
merlin
view thread (17+ messages)
Message-ID: <y2kb42b73151004240820u5a0082dt2201eef3c4dafa87@mail.gmail.com>
Permalink: ../y2kb42b73151004240820u5a0082dt2201eef3c4dafa87@mail.gmail.com/
Also on: postgresql.org/message-id/y2kb42b73151004240820u5a0082dt2201eef3c4dafa87@mail.gmail.com
copy link · copy postgr.es
reply 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: mmoncure@gmail.com, gryzman@gmail.com, egable+pgsql-performance@gmail.com
Subject: Re: Replacing Cursors with Temporary Tables
In-Reply-To: <y2kb42b73151004240820u5a0082dt2201eef3c4dafa87@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