【问题标题】:Greenplum: Functions that execute SQL statements from the segDBs are not yet supportedGreenplum:尚不支持从 segDB 执行 SQL 语句的函数
【发布时间】:2011-06-02 17:16:55
【问题描述】:

当我尝试从 SNE GP 版中我的一张表上的插入触发器集调用函数时收到此错误:

ERROR:  Functions that execute SQL statements from the segDBs are not yet supported (spi.c:203)  (seg0 localhost:50001 pid=5504)
DETAIL:  
  SQL statement "SELECT DISTINCT min(zasn) FROM zeusasn WHERE zasn IN (SELECT asn FROM asntable where ip >>= '10.29.249.121')"
PL/pgSQL function "eptriggerfn" line 5 at SQL statement

********** Error **********

ERROR: Functions that execute SQL statements from the segDBs are not yet supported (spi.c:203)  (seg0 localhost:50001 pid=5504)
SQL state: XX000
Detail: 
  SQL statement "SELECT DISTINCT min(zasn) FROM zeusasn WHERE zasn IN (SELECT asn FROM asntable where ip >>= '10.29.249.121')"
PL/pgSQL function "eptriggerfn" line 5 at SQL statement

这可能是什么原因?触发器 + 函数在同一个数据库中的另一个表上工作得很好。

提前致谢!

Rgds, 基兰

【问题讨论】:

    标签: sql postgresql greenplum


    【解决方案1】:

    由于Greenplum跨多个节点进行分布式处理,一个查询中的一个查询不能充分利用处理能力,所以不支持。

    当我们进行切换时,我们遇到了类似的问题:

    select      *,
                country_name(country_id)
    from        sales
    where       country_id in (224, 105);
    

    函数country_name()基本上对每个id做了一个子查询来获取国家名称。所以我们不得不将查询更改为:

    select      *,
                c.country_name
    from        sales
    left join   country as c using (country_id)
    where       country_id in (224, 105);
    

    ...问题解决了。我知道这似乎需要做很多工作,但这样做的好处是值得的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多