Re: [INTERFACES] More protocol discussion: breaking down query processing

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: [INTERFACES] More protocol discussion: breaking down query processing
Date: 2003-04-07 20:08:04
Message-ID: 87smsuvzob.fsf@stark.dyndns.tv
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-interfaces


Yay, this would be very cool.

Two small things to keep in mind during design, though they aren't necessarily
things needed in a first implementation:

1) There's an alternate form of the execute step that provides an array of
sets of bind values and executes the original query many times, once for
each set of bind values. This is essential for performing large batch data
updates efficiently. Usually this would be for insert or update statements,
I'm not sure if other databases even allow it for select queries, though I
could imagine it being useful.

2) There could be an option to delay optimization until the bind stage. This
would be an option the interface layer or application would provide in
cases where either the query is unlikely to be repeated (such as if it was
called from a higher level function that does the parse and bind step
together) or is likely to be heavily affected by the input parameters (if
the application programmer knows something special about the data
distribution).

Oh, and I'm sure it's obvious, but there would be no problem having multiple
open cursors, right? So an application could prepare all the queries it's
going to ever execute during initialization, then execute query 1, and for
each row it fetches from 1 execute query 2 with calculated values. For some
reason this isn't working with the PHP interface currently, I assume that's
just a bug in the PHP driver, not in libpq.

--
greg

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jason M. Felice 2003-04-07 20:10:03 Re: No merge sort?
Previous Message Kevin Brown 2003-04-07 20:00:22 Re: Incorrect expected rows by ANALYZE

Browse pgsql-interfaces by date

  From Date Subject
Next Message Michiel Lange 2003-04-07 21:40:05 "translate" libpq++ to libpqxx
Previous Message C. Maj 2003-04-07 18:47:08 Re: Problem seeing list of available tables in pgaccess