Subject Re: [firebird-support] Is ESQL Faster than Dynamic SQL.
Author Milan Babuskov
inoffensive_2006 wrote:
> I've been using dynamic SQL to build my SQL in C++ strings

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.

> and passing them to Firebird through IBPP's facilities. This
> has been working well, but I'm looking to speed up performance.
> In particular, we want to speed up SELECTS.

My example used INSERTs, but the same thing works for selected.

> My partner and friend in this project tells me that using
> static SQL will improve performance of the SELECTS.

I assume that 'static SQL' is my former example, and 'dynamic SQL' would
be my latter example?

> I use IBPP's Prepare() and Execute(). Then I call Fetch()
> for each record.

This sounds correct. Care to post some actuall code?

> Would replacing this dynamic SQL with ESQL provide a
> performance advantage?

You mean, use ESQL instead of IBPP. While I guess it could spare you
some function calls, IBPP is a very light wrapper. I don't think the
difference would be noticeable.


--
Milan Babuskov
http://fbexport.sourceforge.net