[英]Need to find dependent stored procedure list in Redshift
There is a table in redshift, which is causing a problem to complete a run as it has huge data set. redshift 中有一个表,由于它具有庞大的数据集,导致无法完成运行。 So I need to replace the table with another table.
所以我需要用另一个表替换表。 This table is present in few stored procedure code.
该表存在于少数存储过程代码中。 But here is a challenge.
但这是一个挑战。 There are around 300+ stored procedure in the database.
数据库中大约有 300 多个存储过程。 So, anyone please help me to write with a query, like what are list of procedures that using the particular table.
所以,任何人都请帮我写一个查询,比如使用特定表的过程列表是什么。
You could query the catalog pg_proc
like this to find out if <particular table>
is used in a stored procedure:您可以像这样查询目录
pg_proc
以查明<particular table>
是否在存储过程中使用:
SELECT n.nspname as schema_name,
u.usename as sp_owner,
p.proname as stored_procedure_name,
p.prosrc as procedure_source
FROM pg_catalog.pg_namespace n
JOIN pg_catalog.pg_proc p ON pronamespace = n.oid
JOIN pg_catalog.pg_user u on u.usesysid = p.proowner
where prosrc like '%<particular table>%';
Or you could use PG_PROC_INFO , a Redshift system view built on the PostgreSQL catalog table PG_PROC
and the internal catalog table PG_PROC_EXTENDED
.或者您可以使用PG_PROC_INFO ,这是一个基于 PostgreSQL 目录表
PG_PROC
和内部目录表PG_PROC_EXTENDED
构建的 Redshift 系统视图。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.