Commit 99b454aa by hejiangming

修复ods_st_key索引创建

parent a7e6d6ef
......@@ -52,15 +52,19 @@ if __name__ == '__main__':
SSHUtil.exec_command_async(client, sh, ignore_err=False)
client.close()
# 创建索引,交换表名
# 填充 tsvector 列,手动创建全部索引(不依赖 cp_index_flag 从老表拷贝,避免索引累积)
sql = f"""
update {export_tb} set keyword_tsv = to_tsvector('english_amazonword', search_term);
CREATE INDEX ON {export_tb} (st_key);
CREATE INDEX ON {export_tb} (search_term);
CREATE INDEX ON {export_tb} USING gin (keyword_tsv);
"""
DBUtil.engine_exec_sql(engine, sql)
DBUtil.exchange_tb(
engine=engine,
source_tb_name=export_tb,
target_tb_name=export_tb_target,
cp_index_flag=True
cp_index_flag=False
)
print("success!")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment