pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Boszormenyi Zoltan <zb@cybertec.at>
To: Noah Misch <noah@leadboat.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Michael Meskes <meskes@postgresql.org>
Cc: PG Hackers <pgsql-hackers@postgresql.org>
Cc: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
Cc: Bruce Momjian <bruce@momjian.us>
Subject: Re: ECPG FETCH readahead
Date: Sat, 24 Mar 2012 10:49:07 +0100
Message-ID: <4F6D9893.3030300@cybertec.at> (raw)
In-Reply-To: <CA+TgmoaBGLpW5V3nFES-McLbZyY_9nUvpnFLjT7zAYuVPu809A@mail.gmail.com>
References: <4C231F9E.6000102@enterprisedb.com>
	<20100624121922.GD24137@feivel.credativ.lan>
	<AANLkTinij9ULnS54zKsdAJnhvuj-07-8-T-D=Nwk6f14@mail.gmail.com>
	<4CB6D3C8.3020709@cybertec.at>
	<4EC41434.7010603@cybertec.at>
	<4EFC36EF.1060308@cybertec.at>
	<20120302164105.GD23100@tornado.leadboat.com>
	<4F538B4C.1030605@cybertec.at>
	<20120305185632.GE13348@tornado.leadboat.com>
	<4F55A9AD.6050600@cybertec.at>
	<20120306110658.GC15988@tornado.leadboat.com>
	<CA+TgmoaBGLpW5V3nFES-McLbZyY_9nUvpnFLjT7zAYuVPu809A@mail.gmail.com>

2012-03-15 21:59 keltezéssel, Robert Haas írta:
> I think we need either an updated version of this patch that's ready for commit real 
> soon now, or we need to postpone it to 9.3. 

Sorry for the delay, I had been busy with other tasks and I rewrote this code
to better cope with unknown result size, scrollable cursors and negative
cursor positions.

I think all points raised by Noah is addressed: per-cursor readahead window size,
extensive comments, documentation and not enabling result set size discovery.

Also, I noticed this in passing:

static void
free_variable(struct variable * var)
{
         struct variable *var_next;

         if (var == NULL)
                 return;
         var_next = var->next;
         ecpg_free(var);

         while (var_next)
         {
                 var = var_next;
                 var_next = var->next;
                 ecpg_free(var);
         }
}

I rewrote this as below to eliminate manual unrolling of the loop,
they are equivalent:

static void
free_variable(struct variable * var)
{
         struct variable *var_next;

         while (var)
         {
                 var_next = var->next;
                 ecpg_free(var);
                 var = var_next;
         }
}


The problem with WHERE CURRENT OF is solved by a little more grammar
and ecpglib code, which effectively does a MOVE ABSOLUTE N before
executing the DML with WHERE CURRENT OF clause. No patching of the
backend. This way, the new ECPG caching code is compatible with older
servers but obviously reduces the efficiency of caching.

Attached are two patches, the first one is the feature patch.

The second patch makes all cursor statements go through the new
caching functions with 1 tuple readahead window size. It only changes
the preprocessed code and stderr logs of the regression tests affected,
not their results.

Best regards,
Zoltán Böszörményi

-- 
----------------------------------
Zoltán Böszörményi
Cybertec Schönig&  Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de
      http://www.postgresql.at/

Attachments:

  [application/x-tar] ecpg-cursor-readahead-9.2-git-v12.patch.gz (38.0K, ../4F6D9893.3030300@cybertec.at/2-ecpg-cursor-readahead-9.2-git-v12.patch.gz)
  download

  [application/x-tar] ecpg-cursor-readahead-all-cursors.patch.gz (19.9K, ../4F6D9893.3030300@cybertec.at/3-ecpg-cursor-readahead-all-cursors.patch.gz)
  download

view thread (69+ messages)  latest in thread

Message-ID: <4F6D9893.3030300@cybertec.at>
Permalink:  ../4F6D9893.3030300@cybertec.at/
Also on:    postgresql.org/message-id/4F6D9893.3030300@cybertec.at

 · 

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-hackers@postgresql.org
  Cc: zb@cybertec.at, noah@leadboat.com, robertmhaas@gmail.com, meskes@postgresql.org, heikki.linnakangas@enterprisedb.com, bruce@momjian.us
  Subject: Re: ECPG FETCH readahead
  In-Reply-To: <4F6D9893.3030300@cybertec.at>

* 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