Re: ECPG FETCH readahead - Mailing list pgsql-hackers

From Boszormenyi Zoltan
Subject Re: ECPG FETCH readahead
Date
Msg-id 4F6D9893.3030300@cybertec.at
Whole thread Raw
In response to Re: ECPG FETCH readahead  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: ECPG FETCH readahead  (Noah Misch <noah@leadboat.com>)
List pgsql-hackers
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/


Attachment

pgsql-hackers by date:

Previous
From: Qi Huang
Date:
Subject: Re: Gsoc2012 Idea --- Social Network database schema
Next
From: Gianni Ciolli
Date:
Subject: Re: [PATCH] Support for foreign keys with arrays