Subject RE: [firebird-support] Re: Building query strings in stored procedures?
Author Tim Gahnström
> -----Original Message-----
> Helen's book is pretty off putting about using this approach,
> however (page 594). She mentions that this will be slow, and
> this agrees with comments (from Tim) earlier in this thread.


Welll... All I know I learned from the big book :)

> I haven't yet done any tests on fully loaded database, but if
> there is no appreciable improvement (speed & ease versus
> ordinary SQL select queries straight from web application) in
> doing things this way, perhaps there is no point after all!
> As mentioned previously, using an SP with pre-constructed,
> layered IF NULL statements etc.. I notice that the SP is
> roughly 3 times quicker than a straight SQL select query.

Passing a string (or array) to the SP and run it with one big execute statement will never be faster (or slower) than putting it in dynamically generated select statement on the php side. I would guess it is executed pretty much the same way but it might give a cleaner syntax on the php side if that is desirable.

If you need the speedup or (for another reason) intend to try with layered IF NULL statements etc you should also look into the COALESCE and case statements in FB they will help a lot (but can likley not get you all the way).
This have some advantages in terms of speed and syntax and type safety.

Tim