pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Stark <gsstark@mit.edu>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org
Cc: pgsql-interfaces@postgresql.org
Subject: Re: [INTERFACES] More protocol discussion: breaking down query processing
Date: 07 Apr 2003 16:08:04 -0400
Message-ID: <87smsuvzob.fsf@stark.dyndns.tv> (raw)
In-Reply-To: <24009.1049325358@sss.pgh.pa.us>
References: <24009.1049325358@sss.pgh.pa.us>


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




view thread (4+ messages)  latest in thread

Message-ID: <87smsuvzob.fsf@stark.dyndns.tv>
Permalink:  ../87smsuvzob.fsf@stark.dyndns.tv/
Also on:    postgresql.org/message-id/87smsuvzob.fsf@stark.dyndns.tv

 · 

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-interfaces@postgresql.org
  Cc: gsstark@mit.edu, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org
  Subject: Re: [INTERFACES] More protocol discussion: breaking down query processing
  In-Reply-To: <87smsuvzob.fsf@stark.dyndns.tv>

* 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