Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 10951 invoked from network); 8 Feb 2010 23:51:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Feb 2010 23:51:48 -0000 Received: (qmail 9752 invoked by uid 500); 8 Feb 2010 23:51:48 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 9732 invoked by uid 500); 8 Feb 2010 23:51:48 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 9724 invoked by uid 99); 8 Feb 2010 23:51:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Feb 2010 23:51:48 +0000 X-ASF-Spam-Status: No, hits=-4.0 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [192.18.6.24] (HELO gmp-eb-inf-2.sun.com) (192.18.6.24) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Feb 2010 23:51:38 +0000 Received: from fe-emea-09.sun.com (gmp-eb-lb-1-fe1.eu.sun.com [192.18.6.7] (may be forged)) by gmp-eb-inf-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id o18NpHJ7019874 for ; Mon, 8 Feb 2010 23:51:17 GMT MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; format=flowed Received: from conversion-daemon.fe-emea-09.sun.com by fe-emea-09.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul 2 2009)) id <0KXJ00G00RF56O00@fe-emea-09.sun.com> for derby-dev@db.apache.org; Mon, 08 Feb 2010 23:50:57 +0000 (GMT) Received: from [192.168.0.199] ([unknown] [84.215.174.92]) by fe-emea-09.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul 2 2009)) with ESMTPSA id <0KXJ003UNRKT0T50@fe-emea-09.sun.com> for derby-dev@db.apache.org; Mon, 08 Feb 2010 23:50:57 +0000 (GMT) Date: Tue, 09 Feb 2010 00:50:53 +0100 From: Kristian Waagan Subject: Re: Access to old and new values of the triggering table's columns inside the trigger action when trigger action is a stored procedure... In-reply-to: Sender: Kristian.Waagan@Sun.COM To: derby-dev@db.apache.org Message-id: <4B70A35D.5080804@Sun.COM> Organization: Sun Microsystems Inc. References: <4B6D8DE1.5020700@sun.com> <4B6EA0E8.40904@Sun.COM> User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) X-Virus-Checked: Checked by ClamAV on apache.org Mamta Satoor wrote: > Hi Kristian, > > I was thnking that may be I could look at how to implement 'if there > is no REFERENCING clause in crate trigger definition, then don't keep > before and after copies.' or is that something you are already looking > at. I don't want to duplicate the work if you are already looking at > this and other scenarios for triggers so thought would check with you > first before doing any work. > Hi Mamta, No, I'm not working at what you describe, feel free to continue! It will benefit us a lot to have the functionality you are working on. I'm working on avoiding materializing LOBs. Combined these two fixes might get us pretty close to a much better solution :) FYI, I'll need a few more days before I can post something. In any case, both pieces of work will improve the situation in different ways - independent of each other. Regards, -- Kristian > I am almost finished up writing the stand alone test cases for various > scenarios for triggers and LOB combinations. Hope to have those tests > posted in jira by tomorrow. The reason they are standalone is that at > this point, I do not know if there is any way to have the iteration of > steps a)do the necessary setup for the test b)run the associated test > for the setup with limited heap to have it run into OOM and then go > back to a) for the next test. > > thanks, > Mamta > > On Sun, Feb 7, 2010 at 3:15 AM, Kristian Waagan wrote: > >> Knut Anders Hatlen wrote: >> >>> Mamta Satoor writes: >>> >>> >>> >>>> Rick, thanks as always. All this makes sense. My recent emails about >>>> trigger behaviors are to see where we can avoid having before and >>>> after copies of the LOB columns in the triggering table so we don't >>>> run into OOM when it can be avoided. >>>> >>>> Since the only way to pass before and old values to the stored >>>> procedure in trigger action is through formal arguments, then I guess >>>> we can safely assume that before and after values of LOB columns from >>>> triggering tables will never make their way into stored procedure. The >>>> Derby Reference manual says "Note: Data-types such as BLOB, CLOB, LONG >>>> VARCHAR, LONG VARCHAR FOR BIT DATA, and XML are not allowed as >>>> parameters in a CREATE PROCEDURE statement." >>>> >>>> >>> This limitation is likely to be lifted, though. See DERBY-4066. >>> >>> >>> >>>> So based on the fact that stored procedure gets before and old values >>>> through parameters and LOBs can't be passed as parameters to stored >>>> procedure, there is no need for us to keep before and after values of >>>> LOB columns from the triggering table when the trigger action is a >>>> stored procedure. >>>> >>>> >>> I haven't looked at the code, so I don't know how viable the different >>> approaches are, but I would think that looking at which columns the >>> different triggers actually reference is a more robust way to determine >>> which columns to copy into the before and after images. Then we would >>> save memory/copying for trigger actions that don't call stored >>> procedures too, and also for non-LOB types. >>> >>> >>> >> I agree with Knut Anders on this one, it would be nice if we could determine >> which columns to copy. >> >> That said, as part of my current LOB work, I'm looking at how to avoid >> materializing (or objectifying) LOB columns for triggers. This will >> definitely help for the cases where the LOB columns aren't referenced / >> used, and it may also enable us to keep the values as streams in other cases >> where the LOB is actually used in the trigger. >> This work is still in the early phase, but I have been able to remove some >> of the work-arounds / fixes put in place earlier. It is not yet clear to me >> if this approach will get me anywhere, but I'll investigate further. >> >> >> Regards, >> -- >> Kristian >> >> >>