Materialize Logo

Materialize Cloud Quickstart

WARNING! Materialize Cloud is still in alpha. You may experience unexpected downtime, data loss, or reset sources and views as we upgrade the infrastructure and add new features.

If you're interested in trying out Materialize Cloud, let us know.

To get you started, we’ll walk you through the following:

  1. Signing up for Materialize Cloud
  2. Creating a Materialize Cloud deployment
  3. Connecting to the deployment from a terminal
  4. Connecting to a data source
  5. Running sample queries

Sign up for Materialize Cloud

Sign up at

Create and connect to a Materialize Cloud deployment

Once you sign up for Materialize Cloud and log in, you use the Deployments page to create, upgrade, or destroy deployments, and to obtain the TLS certificates you need to install on your local machine so you can connect to deployments.

By default, you can create up to two deployments. If you’re interested in more, let us know.

  1. On the Deployments page, click Create deployment. Materialize creates a deployment and assigns it a name and hostname.

  2. Click the Connect button in the same row as the deployment.

  3. Click Download certificates.

  4. Unzip the certificate package.

  5. To connect to the deployment with the psql command-line tool, copy the command from the connection dialog and run it from the directory that contains the certificates.

    The sample code below will not work unless you substitute your real hostname.

    psql "postgresql://materialize@hostname:6875materialize?

    If you’ve just created the deployment, you may need to wait a minute or two before you’ll be able to connect.

Connect to a real-time stream and create a materialized view

For this example, we’ll walk you through connecting to a PubNub stream as a data source. Note that PubNub demo streams should only be used for testing, since they are volatile sources that do not meet the consistency and durability requirements necessary for Materialize to guarantee correctness over time.

  1. From your shell, create a source (connect to the PubNub market orders stream with a subscribe key):

    CREATE SOURCE market_orders_raw FROM PUBNUB
      SUBSCRIBE KEY 'sub-c-4377ab04-f100-11e3-bffd-02ee2ddab7fe'
      CHANNEL 'pubnub-market-orders';

    This streams data as a single text column containing JSON.

  2. Extract the JSON fields for each order’s stock symbol and the bid price:

    CREATE VIEW market_orders AS
        val->>'symbol' AS symbol,
        (val->'bid_price')::float AS bid_price
      FROM (SELECT text::jsonb AS val FROM market_orders_raw);
  3. Create a materialized view that determines the average bid price, then return the average:

      SELECT symbol, AVG(bid_price) FROM market_orders
      GROUP BY symbol;
    SELECT * FROM avg_bid;
      symbol    |        avg
    Apple       |  199.3392717416626
    Google      | 299.40371152970334
    Elerium     | 155.04668809209852
    Bespin Gas  |  202.0260593073953
    Linen Cloth | 254.34273792647863

    Wait a few moments and issue SELECT * FROM avg_bid; again to get an updated result based on the latest data streamed in.

  4. Use TAIL see the channel as a stream:

    copy (tail avg_bid) to stdout;

    To cancel out of the stream, press CTRL+C.

You can now experiment with the PubNub source using any supported SQL commands.

Did this info help?
Yes No