Subject | Re: [firebird-support] REBUILDING the INDEXES in Firebird |
---|---|
Author | Alexandre Benson Smith |
Post date | 2006-01-27T22:00:06Z |
Ivan Cruz wrote:
I have an SP like this:
CREATE PROCEDURE THOR_ATUALIZAESTATISTICAINDICE RETURNS
(
INDEXNAME VARCHAR(255)
)
AS
begin
for
select
cast(rdb$Index_Name as varchar(255))
from
rdb$Indices
into
:IndexName
do begin
execute statement 'set statistics index ' || :IndexName;
IndexName = IndexName || ' estatistica atualizada';
suspend;
end
end
and then do it to update the statistcs:
select * from THOR_ATUALIZAESTATISTICAINDICE
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br
>Note: since ALTER INDEX is a DDL command it cannot be usedunless one use the EXECUTE STATEMENT
>inside a stored procedure.
>
>
I have an SP like this:
CREATE PROCEDURE THOR_ATUALIZAESTATISTICAINDICE RETURNS
(
INDEXNAME VARCHAR(255)
)
AS
begin
for
select
cast(rdb$Index_Name as varchar(255))
from
rdb$Indices
into
:IndexName
do begin
execute statement 'set statistics index ' || :IndexName;
IndexName = IndexName || ' estatistica atualizada';
suspend;
end
end
and then do it to update the statistcs:
select * from THOR_ATUALIZAESTATISTICAINDICE
>Ivan.see you !
>
>
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br