Subject Re: What the problem with the optimizer and my SQL?
Author emb_blaster
I´ve found this SQL by Fabiano almost like mine... But still don´t
understand why FB do not do it automaticaly...

set term !! ;

create or alter procedure sp_indices_update
as
declare variable v_index_name varchar(31);
begin
for select
trim(a.rdb$index_name)
from
rdb$indices a
where
coalesce(a.rdb$system_flag, 0) = 0
into
:v_index_name
do
begin
execute statement 'set statistics index ' || v_index_name;
end
end !!


--- In firebird-support@yahoogroups.com, "emb_blaster"
<EMB_Blaster@...> wrote:
>
> Can anyone tell-me if this will run without damage my DB?
>
> FOR
> select RDB$INDEX_NAME from RDB$INDICES
> where RDB$INDICES.RDB$SYSTEM_FLAG = 0
> into :MY_INDEX
> DO SET STATISTICS :MY_INDEX;