Subject Re: [firebird-support] FB sql compilation: buffered or not?
Author Martijn Tonies

> I was looking articles on FB architecture and got an impression that any
> statement submited to FB is compiled every time, i.e. it includes parsing,
> building an execution plan, etc every time even if the same SQL statement
> (possibly only with different bind variables values) is issued again and
> again.
> I.e. no buffer of compiled SQL statements is maintained?
> Does this mean that FB is actually indiferent if bind variables are used
> not, i.e. will the examples bellow have performance difference (I've
> them in some kind of pseudo code which I hope is understandable):
> A)
> execute "select * from EMPLOYEE where name='John' ";
> execute "select * from EMPLOYEE where name='Marry' ";
> Versus:
> B)
> statement := prepare " select * from EMPLOYEE where name=:b1 ";
> statement.bind ( b1, 'John' );
> execute statement;
> statement.bind ( b1, 'Marry' );
> execute statement;

(B) will be much faster. Prepared statement aren't re-evaluated,
but are "buffered". But only on the connection level, not across
different connections.

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Upscene Productions