Subject Re: [IBO] performance improvements
Author Helen Borrie
At 01:10 AM 20/10/2003 +0200, you wrote:
>while reading tips to improve performance found statement, that dublicate
>primary & foreign keys indexes downgrade performace.

True. Don't do it.

>If I have two tables A & B (master-detail relatioship), so I need to set
>indexes only for A & B primary keys?

No. If you have set primary key constraints, the database creates indexes
automatically. Don't create another index on the PK column(s).

>do I need a foreign key for foreign
>key in A table or this would downgrade performance?

It can. Ask on the firebird-support list about indexes of low selectivity
and other issues relating to your database design.

>if using stored procedures & select from it (select * from
>StoredProcedure(params)), prepare would take everytime if I set SQL
>dynamically

Yes. Since the metadata of a stored procedure doesn't change, make sure
that it is prepared only once in a session. Don't set the SQL property in
code unless you have a reason to need it. Set the SQL property in the
event that creates the object and use parameters. You don't have to
unprepare the procedure call to change its parameter values; and always
test before calling Prepare.

The ParamByName() method *always* prepares a statement if it is not already
prepared.

>(this select would occure everytime before opening one form
>while other select would be set to open another forms)

Can't quite work this one out. If your dataset object is created by a
form, then its creation is part of the form's formcreate event. I hope the
notes above answer your question.

Helen