Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id DC3681782AF6 for ; Mon, 2 Apr 2012 13:12:28 -0300 (ADT) Received: from mail-qc0-f174.google.com ([209.85.216.174]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SEjrl-0000xj-PO for pgsql-hackers@postgresql.org; Mon, 02 Apr 2012 16:12:28 +0000 Received: by qcro28 with SMTP id o28so273683qcr.19 for ; Mon, 02 Apr 2012 09:12:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent :x-gm-message-state; bh=yPnqhhdmDExziWWtJ2QnqsB6gqpvHRNIdliSIEDhEwc=; b=ZgT9SfTJbWHoRZ29R7vEAKyNIOsJQb4X/Gx920ef2M8059YJvG/WGbpY/uYMzMSVtx cOA+XXSljq3nHgeHoljkQUR0GGhUYkEeaqhUSP0XMvsTX2hLJYwa9iyg4YZKnge/ARde dsheFGWfpkpNVrdLCNwgUWJCTEu2LNzP2lzhjTNTTcdrgvN7hvxZkXySCDxag12uRgrV 1v6TG8lUGAwv9aZyCBXDzUwUQmXUXs5Gh/nwwLlkem8RISEoJDV7NT46ki3t6lucvzvc hMxWvWhifP9JiC8QpMIqVNATnWCMcuYjVMqUQ+d7VQiFLd30AB5aInHBAqGI725lt/7M dUpg== Received: by 10.224.208.1 with SMTP id ga1mr12081997qab.21.1333383132416; Mon, 02 Apr 2012 09:12:12 -0700 (PDT) Received: from tornado.leadboat.com (ip68-105-236-221.hr.hr.cox.net. [68.105.236.221]) by mx.google.com with ESMTPS id m6sm35277878qah.2.2012.04.02.09.12.10 (version=SSLv3 cipher=OTHER); Mon, 02 Apr 2012 09:12:11 -0700 (PDT) Date: Mon, 2 Apr 2012 12:12:08 -0400 From: Noah Misch To: Boszormenyi Zoltan Cc: Robert Haas , Michael Meskes , PG Hackers , Heikki Linnakangas , Bruce Momjian Subject: Re: ECPG FETCH readahead Message-ID: <20120402161208.GA18340@tornado.leadboat.com> References: <4F538B4C.1030605@cybertec.at> <20120305185632.GE13348@tornado.leadboat.com> <4F55A9AD.6050600@cybertec.at> <20120306110658.GC15988@tornado.leadboat.com> <4F6D9893.3030300@cybertec.at> <20120329004323.GA17329@tornado.leadboat.com> <4F74409C.3050904@cybertec.at> <20120329170341.GA4142@tornado.leadboat.com> <4F74E6A7.8040204@cybertec.at> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4F74E6A7.8040204@cybertec.at> User-Agent: Mutt/1.5.18 (2008-05-17) X-Gm-Message-State: ALoCoQkbzRHL7MB/DZQLqq+o/zDxpZ/ypFNZaIEZ0kTQKrxLjlLaVw+BcO0W+K32RfHBoLFTPT5j X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201204/44 X-Sequence-Number: 205847 On Fri, Mar 30, 2012 at 12:48:07AM +0200, Boszormenyi Zoltan wrote: > 2012-03-29 19:03 keltez?ssel, Noah Misch ?rta: >>>> one of the new sections about readahead should somehow reference the hazard >>>> around volatile functions. >>> Done. >> I don't see the mention in your latest patch. You do mention it for the >> sqlerrd[2] compatibility stuff. > > sqlerrd[2] compatibility stuff? I mentioned it in section "ecpg-sqlca", this is the main > documentation section, not the compatibility one AFAIK. Anyway, I now reference the volatile > function hazard in the first paragraphs added to section "ecpg-cursors". This patch adds two features, and those features are independent from a user perspective. The primary feature is cursor readahead, and the secondary feature is "ecpg --detect-cursor-resultset-size" (the referent of my above "sqlerrd[2] compatibility stuff" reference). Each feature has independent semantic implications when the application uses cursors on queries that call volatile functions. Under --detect-cursor-resultset-size, we will execute functions for all rows at OPEN time and again for each row at FETCH time. When you declare a cursor with "READAHEAD n" and do not FETCH it to the end, up to "n" unFETCHed rows will nonetheless have their functions executed. If the volatile function is something like clock_timestamp(), the application will observe the executions to have happened in clusters of "n" rather than in step with the application's FETCH calls. Your latest patch revision hints at the semantic implications for "ecpg --detect-cursor-resultset-size", but it does not mention them for readahead. Then again, perhaps it's sufficiently obvious to not warrant mention. Without knowing internals, I would not expect users to guess the consequence of "ecpg --detect-cursor-resultset-size". With readahead, it may be guessable enough. Thanks, nm