Re: Pagers and Iterators

[prev] [thread] [next] [Date index for 2005/02/25]

From: Cees Hek
Subject: Re: Pagers and Iterators
Date: 16:41 on 25 Feb 2005
On Fri, 25 Feb 2005 15:37:56 +0000, Simon Wistow <simon@xxxxxxxxxx.xxx> wrote:
> On Fri, Feb 25, 2005 at 09:18:30AM -0500, Cees Hek said:
> > It still seems like the database is the right place to do this work.
> > Can you not write a function in your database that does the
> > calculations?
> 
> When I said 'live' calculation I meant as in 'a calculation that can
> only be done at template time' - in this case fetching a price from a
> web service.

So are you fetching a new price from the webservice for each row
returned from the search and sorting on that?  That is going to be
expensive if your product catalog gets big...

Well, it is still possible to do this in the database, but it gets
much more difficult, and probably not as practical.  You could write a
stored procedure in C that queried the webservice for you (or if you
use PostgreSQL you might be able to write it in perl).  Then you can
still do something like 'SELECT *, foo(product_id) AS foo FROM
products ORDER BY foo LIMIT 10 OFFSET 20;'.

But you are probably better off just doing this in perl directly. 
Although I would suggest you have a good caching system in place so
that you don't have to go back to this webservice every time the user
clicks 'next' to view the next 10 products...

Cheers,

Cees

(message missing)

Pagers and Iterators
Simon Wistow 11:30 on 25 Feb 2005

Re: Pagers and Iterators
Daniel Wijnands 11:34 on 25 Feb 2005

Re: Pagers and Iterators
Simon Wistow 11:47 on 25 Feb 2005

Re: Pagers and Iterators
Sean Davis 11:55 on 25 Feb 2005

Re: Pagers and Iterators
Simon Wistow 12:14 on 25 Feb 2005

Re: Pagers and Iterators
Carl Johnstone 13:23 on 25 Feb 2005

Re: Pagers and Iterators
Cees Hek 14:18 on 25 Feb 2005

Re: Pagers and Iterators
Matt S Trout 14:35 on 25 Feb 2005

Re: Pagers and Iterators
William Ross 12:15 on 25 Feb 2005

Re: Pagers and Iterators
William Ross 14:04 on 25 Feb 2005

Re: Pagers and Iterators
Simon Wistow 15:37 on 25 Feb 2005

Re: Pagers and Iterators
Simon Wistow 16:34 on 25 Feb 2005

Re: Pagers and Iterators
Ofer Nave 20:52 on 25 Feb 2005

Re: Pagers and Iterators
Cees Hek 16:41 on 25 Feb 2005

Re: Pagers and Iterators
Carl Johnstone 17:09 on 25 Feb 2005

Generated at 17:56 on 01 Mar 2005 by mariachi v0.52