Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id C1D97632EDA for ; Fri, 3 Apr 2009 11:08:41 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 30078-06 for ; Fri, 3 Apr 2009 11:08:31 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 42222632D18 for ; Fri, 3 Apr 2009 11:08:40 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id n33E8Zlr028758; Fri, 3 Apr 2009 10:08:35 -0400 (EDT) To: Matthew Wakeling cc: pgsql-performance@postgresql.org Subject: Re: plpgsql arrays In-reply-to: References: Comments: In-reply-to Matthew Wakeling message dated "Fri, 03 Apr 2009 14:32:54 +0100" Date: Fri, 03 Apr 2009 10:08:35 -0400 Message-ID: <28757.1238767715@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.087 tagged_above=0 required=5 tests=AWL=0.087 X-Spam-Level: X-Archive-Number: 200904/64 X-Sequence-Number: 33431 Matthew Wakeling writes: > I have discovered that creating large arrays in plpgql is rather slow. In > fact, it seems to be O(n^2). For variable-width element types, yeah. Don't go that way. > ... alternatively is there a way to read two results streams > simultaneously? Use two cursors and FETCH from each as needed? In recent releases you can even scroll backwards, which you're going to need to do to make a merge join work. regards, tom lane