Search code examples
postgresqlpipelinedb

How do I list all streams and continuous views in pipelinedb?


In pipelinedb I can't seem to locate a way to list all of the streams and continuous views that I've created.

I can back into the CVs by looking for the "mrel" tables that are created but it's kind of clunky.

Is there a system table or view I can query that will list them?


Solution

  • You may have an older version of pipelinedb, or you may be looking at an older version of the docs.

    You can check your version with psql like so:

    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)
    

    In the latest version, information about views can be obtained like so:

    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)
    

    Information about streams can be obtained like so:

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

    More information can be obtained by using \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