Subject Re: [IBO] does a tiboquery in a prepared state consume resources on the server?
Author Helen Borrie
At 05:22 PM 4/06/2003 -0700, you wrote:
>hi,
>subject line says it all. If I open an application and call prepare for all
>of my queries, will this consume FB/IB server resources?

Of course! and network resources also. This is a performance-killer.

Any query must be prepared. The dataset components do it for you. In some
cases, the direct-execution component TIB_DSQL needs you to test and
prepare if necessary. Don't call Prepare in isolation, do it always like this:

if not MyStatement.Prepared then
MyStatement.Prepare;

Don't prepare or open *any* queries until you need them. And write your
applications in such a way that 1) any query is prepared only once and 2)
your parameterised WHERE clauses fetch only the minimum number of rows
needed for the task.

IMPORTANT RULE OF THUMB:
Efficient client/server applications focus on "data for the task", rather
than the traditional Delphi/BDE desktop approach "tasks for the
data". Write client applications, not spreadsheets.

Helen