Subject Re: [firebird-support] Return query from stored procedure
Author Milan Babuskov
Sasa Mihajlovic wrote:
> I have view with 100000 documets (records) diferent type. When I call
> select * from view where type = some_type firebird made full view and
> execute my sql statement. When I call sql statement without view just
> join tables and put where type = some_type I get 20% faster respones
> from database.

This is expected with Firebird 1.x. In fact, it's strange that
difference is only 20%, but then again 100k records isn't that much.

> So how to write SP which will return data like it is described in
> secound sample (without calling view)

I assume your view has UNIONs, so I guess something like:

create procedure select_me ( some_type )
as
begin
for select * from table1 where type = some_type do suspend;
for select * from table2 where type = some_type do suspend;
for select * from table3 where type = some_type do suspend;
end

but you need to show us how your view really looks like and also what
plan do you get with and without view.

> or someone have a better idea
> how to increase speed of my db response?

Use Firebird 2.x

--
Milan Babuskov
http://www.flamerobin.org