[database] Merge queries
Larry Garfield
larry at garfieldtech.com
Sat Jul 19 21:50:57 UTC 2008
On Saturday 19 July 2008 4:32:39 pm you wrote:
> On Sat, 2008-07-19 at 15:53 -0500, David Timothy Strauss wrote:
> > ----- "Larry Garfield" <larry at garfieldtech.com> wrote:
> >
> > I'd suggest creating a function in MySQL and PostgreSQL that handles the
> > queries. The three queries in and of themselves don't take much time; the
> > enemy is the latency of three queries. If an in-database function handles
> > the logic, I think we'll be in good shape.
>
> That would be my suggestion as well.
>
> Joshua D. Drake
Well in MySQL it's already a single query with INSERT ON DUPLICATE KEY UPDATE,
so that's fine. An SQL function for Postgres sounds fine to me, but I have
no idea how to write one. :-) Josh, is that something you could take point
on?
Catch me on IRC if you can and I can walk you through the API for db_merge(),
or the unit tests should be fairly self-explanatory.
--
Larry Garfield
larry at garfieldtech.com
More information about the Database
mailing list