
call sp_iqzonemaps ( [summary_info], [tblnm], [tblown] )
--*******DISCLAIMER*********
--This script is provided "as is" without warranty or support of any kind.
--*******DISCLAIMER*********
drop procedure if exists sp_iqzonemaps;
create procedure sp_iqzonemaps(
in summary_info varchar(3) default 'Y',
in tblnm varchar(128) default '%',
in tblown varchar(128) default '%' )
begin
declare local temporary table ZoneMap_res (
table_owner varchar(128)
, table_name varchar(128)
, RebuildCommand varchar(255)
) in SYSTEM;
declare o varchar(128);
declare t varchar(128);
declare ot varchar(255);
FOR FORLOOP as FORCRSR CURSOR
FOR select table_name, user_name table_owner
from sys.systable, sys.sysuser
where creator <> 3 and server_type = 'IQ'
and table_type <> 'PARTITION'
and creator=user_id
and table_owner like tblown
and table_name like tblnm
do
set o=table_owner;
set t=table_name;
set ot=o+'.'+t;
-- uncomment to see progress
--message 'Table: '||ot to client;
insert into ZoneMap_res
select o,t,rebuildcommand
from dbo.sp_iqzonemapenable( t,o)
where RebuildCommand not like 'No indexes require rebuilding%'
and RebuildCommand not like 'List of FP indexes to be rebuilt%'
;
end for;
-- output
select distinct table_owner, table_name
, convert( varchar(255), case lower( summary_info ) when 'y' then
'Some columns need rebuilding'
else RebuildCommand
end ) Notes
from ZoneMap_res
order by 1,2;
end;
call sp_iqzonemaps();
table_owner table_name Notes
----------------------------
(0 rows)
call sp_iqzonemaps( tblnm='Cust%' );
table_owner table_name Notes
---------------------------------------------------
tpch_user customer Some columns need rebuilding
(1 rows)
call sp_iqzonemaps( 'N', 'Cust%' );
-- equivalent to
-- call sp_iqzonemaps( summary_info='N', tblnm='Cust%' );
table_owner table_name Notes
-----------------------------------------------------------------------------------------------
tpch_user customer call "sp_iqrebuildindex"( 'tpch_user.customer', 'column c_phone')
tpch_user customer call "sp_iqrebuildindex"( 'tpch_user.customer', 'column c_nationkey 25')
tpch_user customer call "sp_iqrebuildindex"( 'tpch_user.customer', 'column c_name')
tpch_user customer call "sp_iqrebuildindex"( 'tpch_user.customer', 'column c_mktsegment 5')
tpch_user customer call "sp_iqrebuildindex"( 'tpch_user.customer', 'column c_custkey')
tpch_user customer call "sp_iqrebuildindex"( 'tpch_user.customer', 'column c_comment')
tpch_user customer call "sp_iqrebuildindex"( 'tpch_user.customer', 'column c_address')
tpch_user customer call "sp_iqrebuildindex"( 'tpch_user.customer', 'column c_acctbal')
(8 rows)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
25 | |
24 | |
16 | |
14 | |
10 | |
9 | |
9 | |
7 | |
7 | |
7 |