cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Can we create Materialized view n exsting view and table?

sboxi
New Contributor II

Dear All,

Is it possible to create Materialized view on view and table (Joining view and table)?

I suspect it is not possible. Please suggest.

Also please provide best way to schedule the refresh of Materialized view.

 

Regards,

Surya

 

2 REPLIES 2

Alberto_Umana
Databricks Employee
Databricks Employee

Hello @sboxi 

Can you try with this, as it looks it is possible, also about scheduling, please refer to below documentation you can use SCHEDULE clause.

 

CREATE MATERIALIZED VIEW IF NOT EXISTS my_materialized_view AS

SELECT

    t.column1,

    v.column2,

    AVG(t.column3) AS avg_column3

FROM

    my_table t

INNER JOIN

    my_view v

ON

    t.id = v.id

GROUP BY

    t.column1, v.column2;

https://docs.databricks.com/ja/sql/language-manual/sql-ref-syntax-ddl-create-materialized-view.html

sboxi
New Contributor II

Thanks @Alberto_Umana . I will try that.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group