Subject RE: [firebird-support] Re: Is ESQL Faster than Dynamic SQL.
Author Dean Harding
> > What does this mean exactly? Are you using parameters, or write
> > everything as strings? IOW, are you doing:
> >
> > st->Prepare("insert into t1 values (?,?)");
> > st->Set(1, "this1");
> > st->Set(2, "that1");
> > st->Execute();
> > st->Set(1, "this2");
> > st->Set(2, "that2");
> > st->Execute();
> >
> >
> > or you are doing this:
> >
> > st->Prepare("insert into t1 values ('this1','that1')");
> > st->Execute();
> > st->Prepare("insert into t1 values ('this2','that2')");
> > st->Execute();
> >
> > The former one is much faster.
>

> How much faster? My code is more like the latter.



It depends on your queries: if they're mostly the same, differing only by
parameter values, the server is able to cache the execution plan in the
first case, but not the second. For INSERT statemenets, the difference is
probably not significant, but it can be for complex SELECTs (at least,
complex SELECTs that don't return a lot of rows...)



At the end of the day, though, whether you use IBPP or ESQL is probably
going to be irrelevant: once the command gets to the server, it processes
them identically. The biggest win would be from the change described above.



Dean.



[Non-text portions of this message have been removed]