Subject Re: [firebird-support] How a stored procedure exectute?
Author Thomas Steinmaurer
> Dear experts!
> I supposed that a stored procedure execute and return a temporary
> table. However, I am wrong! When I execute the following SQL:
> select * from mysp();
> it costs about 1 second.
> select * from mysp() where t=100
> it costs about 1 second
> but
> select * from mysp() where t=110
> it costs 4 second.
> I try many times and get same results.
> I use IBExpert to make analysis, I found that the number of indices
> read when the stored procedure executes are differnts at last two cases.
> Please help me!

This is one scenario where a view might be faster, because a view
possibly can utilize an existing index, whereas a SP with a WHERE clause
when calling the SP can't.

--
Best Regards,
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database, MS SQL Server and
NexusDB V2
Upscene Productions
http://www.upscene.com
My blog:
http://blog.upscene.com/thomas/