【问题标题】:How do I list all streams and continuous views in pipelinedb?如何列出 pipelinedb 中的所有流和连续视图?
【发布时间】:2016-03-30 14:31:28
【问题描述】:

在 pipelinedb 中,我似乎找不到列出我创建的所有流和连续视图的方法。

我可以通过查找已创建的“mrel”表返回 CV,但这有点笨拙。

是否有我可以查询的系统表或视图来列出它们?

【问题讨论】:

  • 文档说:SELECT * FROM pipeline.pipeline_views(); 应该可以工作,但该功能不存在。

标签: postgresql pipelinedb


【解决方案1】:

很简单,

随便写

select * from pipeline_streams();

要查看管道流及其内部,您可以查看哪个流具有哪些视图。

编辑: 以上代码 sn-p 仅适用于 0.9.x 版本的 PipelineDB,因为它是 1.x 版本的 PostgreSQL 扩展,您将使用外部表作为流

psql -c "\dE[S+];"

此代码将显示 psql 上的所有外部表(pipelinedb 上的流)。

欲了解更多信息:http://docs.pipelinedb.com/streams.html

【讨论】:

    【解决方案2】:

    您可能使用的是旧版本的 pipelinedb,或者您可能正在查看旧版本的文档。

    您可以像这样使用 psql 检查您的版本:

    pipeline=# select * from pipeline_version();
                                                                         pipeline_version                                                                      
    -----------------------------------------------------------------------------------------------------------------------------------------------------------
     PipelineDB 0.9.0 at revision b1ea9ab6acb689e6ed69fb26af555ca8d025ebae on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4, 64-bit
    (1 row)
    

    在最新版本中,可以这样获取视图信息:

    pipeline=# select * from pipeline_views();
     id | schema | name |         query         
    ----+--------+------+-----------------------
     11 | public | cv   |  SELECT x::integer,  +
        |        |      |     count(*) AS count+
        |        |      |    FROM ONLY s       +
        |        |      |   GROUP BY x::integer
    (1 row)
    

    可以像这样获取有关流的信息:

    pipeline=# select * from pipeline_streams();
     schema | name | inferred | queries |                tup_desc                
    --------+------+----------+---------+----------------------------------------
     public | s    | t        | {cv}    | \x000000017800000006a4ffffffff00000000
    (1 row)
    

    更多信息可以使用\d+:

    pipeline=# \d+ cv
                 Continuous view "public.cv"
     Column |  Type   | Modifiers | Storage | Description 
    --------+---------+-----------+---------+-------------
     x      | integer |           | plain   | 
     count  | bigint  |           | plain   | 
    View definition:
     SELECT x::integer,
        count(*) AS count
       FROM ONLY s
      GROUP BY x::integer;
    
    pipeline=# \d+ s
                         Stream "public.s"
          Column       |            Type             | Storage 
    -------------------+-----------------------------+---------
     arrival_timestamp | timestamp(0) with time zone | plain
    

    【讨论】:

    • 是的。我正在使用旧版本。这就解释了为什么几周前我没有在文档中看到任何内容。是时候升级了。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-06
    • 2021-02-05
    • 2017-05-25
    • 1970-01-01
    相关资源
    最近更新 更多