Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 1D84A1337BA3 for ; Fri, 15 Apr 2011 20:27:47 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 57032-07 for ; Fri, 15 Apr 2011 23:27:29 +0000 (UTC) Received: from mx1.hub.org (mx1.hub.org [200.46.208.106]) by mail.postgresql.org (Postfix) with ESMTP id D38F91337BBB for ; Fri, 15 Apr 2011 20:27:28 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.esilo.com (ns1.esilo.com [63.150.152.211]) by mx1.hub.org (Postfix) with ESMTP id A1B7E32625BE for ; Fri, 15 Apr 2011 23:27:28 +0000 (UTC) Received: from [192.168.0.2] (75-149-240-149-Miami.hfc.comcastbusiness.net [75.149.240.149]) (authenticated bits=0) by mail.esilo.com (8.13.1/8.13.1) with ESMTP id p3FNRKwT017802 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Fri, 15 Apr 2011 19:27:21 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=simple/simple; d=esilo.com; s=200912; t=1302910042; bh=XxNVwW6h8sFU/dKhmWCVDh3Ic0I=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=KRmaW2rjQJ22yzKAVlXD3PtSXMZnS0PD2P56SHYty4+tMw8ZYExXe/Q3JIsTm9k6i b1ZcEj7TbW/OIVseWl93zJvOuGjsKy5mfa51mq5TsdzGNNXoiyWgA2aIhLQ8doYRU0 iYjpkAPb5Yt6Fo6YXXC6xId85nRvmag6hlQ3207A= DomainKey-Signature: a=rsa-sha1; s=main; d=esilo.com; c=simple; q=dns; b=FK1kRMCmBnhzWRj9gIfwUi9iS0DKujUBbtnk0lm0ZholypAxUDeiSlC0I2y5LoWSD Nai653fyAwHUSfS/AWd6Q== Message-ID: <4DA8D48B.2050404@esilo.com> Date: Fri, 15 Apr 2011 19:28:11 -0400 From: Andrew Chernow User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110303 Lightning/1.0b2 Thunderbird/3.1.9 MIME-Version: 1.0 To: Kevin Grittner CC: Merlin Moncure , pgsql-bugs@postgresql.org, Tom Lane , Rikard Pavelic Subject: Re: BUG #5982: recursive type crashes postgres References: <201104151834.p3FIYSQ0067290@wwwmaster.postgresql.org> <28780.1302894395@sss.pgh.pa.us> <4DA8AAD7.9000606@zg.htnet.hr> <4DA86904020000250003C8CD@gw.wicourts.gov> <4DA8720F020000250003C8D5@gw.wicourts.gov> <4DA87D03020000250003C8E5@gw.wicourts.gov> In-Reply-To: <4DA87D03020000250003C8E5@gw.wicourts.gov> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201104/120 X-Sequence-Number: 30039 On 4/15/2011 6:14 PM, Kevin Grittner wrote: > Merlin Moncure wrote: > >> Consider we also have to send data to the database. I can >> recursively wrap up data in the client using libpqtypes, fire it >> to a receiving function which unnests it and processes it. This >> is a couple of orders of magnitude faster than streaming it in >> over multiple queries. > > I'll think on that. I hadn't really considered creating an ORM in > the database engine itself, which seems to me to be what you're > describing, but I guess it couldn't be worse than having an ORM on > the other end of the wire. > > Is that a hard sell to your application programmers, or do you wear > both hats? > libpqtypes is very easy to use, small learning curve. Should be easy for someone with libpq experience. Merlin is describing loop,pack,exec vs. loop,exec where the former packs an array of parameters and performs one transaction, and the latter must execute multiple transactions one at a time. If you take the params of an insert and create a composite out of it, you can wrap the insert into a function that takes an array of that composite. You are not creating any new bindings, translations or encodings, just leveraging existing functionality a little differently. -- Andrew Chernow eSilo, LLC global backup http://www.esilo.com/