Subject Re: [firebird-support] Re: Stored procedures vs Dynamic SQl
Author Daniel Rail
Hi,

At July 17, 2005, 00:37, women_lover_best wrote:

> for our project..i want to go for dynamic sql ..using a product like
> llbgen..i feel stored procedures are a pain and difficult to maintain
> especially if database design changes a lot..and i dont think getting
> database desin right first time ever happens..yur take on this?

You are correct in assuming that the database design will not be 100%
perfect initially and that it will evolve as the application is
developed.

Also, I do use stored procedures in some cases where the query would
be too complex to maintain and read. Here's an example: An aged
accounts receivable query, where designing a single query to retrieve
that information was too difficult to debug and slow, a stored
procedure with more manageable smaller queries is faster.

So my advice is to carefully plan your queries and profile them. When
one query is complex(includes subqueries within the result set portion
of the query) and slow, try to see if it can be rewritten differently
and if not try using a stored procedure by separating the complex
query into separate queries. In most cases, it's just experimentation.


--
Best regards,
Daniel Rail
Senior Software Developer
ACCRA Consultants Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.filopto.com)