小工具-Greenplum数据库中AO表和非AO表获取
–执行说明
/*该脚本是用来获取数据库中每个 schema 下是否是 AO 表,如果有 AO 表,将会存储于临时表
*tab_aotable中,如果是非 AO 表,那么将会存储于临时表 tab_naotable 中,由于存储非AO
*表和AO表都是存储于临时表中的,因此在会话退出后,临时表将会自动销毁,如果需要获取,
*请重新执行以下语句
*/
drop table if exists tab_aotable;
drop table if exists tab_naotable;
create temporary table tab_aotable(table_oid oid,table_name text,aotable text,cond char(1)) distributed by (table_oid);
create temporary table tab_naotable(table_oid oid,table_name text,naotable text,cond char(1)) distributed by (table_oid);
create or replace function f_get_aotable()
returns void
as
$$
declare
v_list_toid oid;
v_list_tname text;
v_sql text;
v_is_ao_tablename text;
v_table_oid oid;
v_table_name text;
v_is_ao_table text;
cur1 CURSOR FOR
SELECT a.oid,
c.nspname ||'.' || b.tablename
FROM pg_class a,
pg_tables b,

这是一个用于获取Greenplum数据库中所有schema下AO表和非AO表的小工具。执行脚本将结果存储在临时表`tab_aotable`和`tab_naotable`中,临时表在会话结束后自动销毁,如需再次获取,需重新执行脚本。
7211

被折叠的 条评论
为什么被折叠?



