Subject | [firebird-support] Re: Slow left join with stored procedure |
---|---|
Author | Svein Erling Tysvær |
Post date | 2010-08-11T08:27:31Z |
>I'm very confused when using a stored procedure.I don't use stored procedures much at all, and certainly not if it is a simple case of creating a sum. Though there are situations not solvable in simple queries or where stored procedures makes things easier to read or quicker to execute. To mention three example:
>And I'm still a beginner with the firebird.
>
>Thanks to Helen and Svein.
You have a table named PERSONS and want to return each row as many times as there are letters in the persons' name. I think this could be solvable in a query, but a stored procedure sounds simpler.
You want the results to return a column with the row number or a running total and for unknown reason you want to do that on the server rather than the client. This is possible to do in a query using a recursive CTE, but it is easier to understand if done in a stored procedure.
You want to update a huge table with values from a small table where some key value match. One option is to use an UPDATE query with WHERE EXISTS, but since it is a huge table, that will be time consuming. In a stored procedure you could first select from the small table and then update records and the process would be much quicker.
HTH,
Set