SlideShare a Scribd company logo
Lecture 08 Materialized View
Department of Computer Science Kardan University
Materialized View
Lec-08
Prepared by
Bilal Khan
Lecture 08 Materialized View
2
 A materialized view (MV) is a database object that
stores the results of a query at a single point in time.
Unlike a view, materialized view is not virtual.
 Materialized views are sometimes referred to as
snapshots.
 Materialized views may be stored locally or remotely in
other site.
Lecture 08 Materialized View
3
 Increase query performance since it contains results of a query.
 Remote materialized views are an efficient way to replicate
data at different sites compared to fully consistent distributed
data.
◦ Do not require dedicated network connection and network load is
reduced.
◦ Efficiently support remote users
Lecture 08 Materialized View
4
 Materialized View Management
◦ Define materialized view
◦ Refresh materialized view
 Data of a materialized view may be out-of-date and require to be
refreshed.
◦ Drop materialized view
Lecture 08 Materialized View
5
 Basic Syntax
CREATE MATERIALIZED VIEW view-name
BUILD [IMMEDIATE | DEFERRED]
REFRESH [FAST | COMPLETE | FORCE ]
ON [COMMIT | DEMAND ]
[ON PREBUILT TABLE]
AS
SELECT ...;
Lecture 08 Materialized View
6
 Types of Materialized Views
◦ Read-Only Materialized Views
◦ Updatable Materialized Views
Lecture 08 Materialized View
7
 Types of Materialized Views
◦ Read-Only Materialized Views
◦ Records in the MV cannot be changed by users.
◦ Eliminates the possibility of a materialized view introducing
data conflicts with the master (base tables).
Lecture 08 Materialized View
8
 Types of Materialized Views
◦ Updatable Materialized Views
◦ Users can make changes to the data at the materialized view
site.
◦ Changes made to an updatable materialized view are pushed
back to the master during refresh.
Lecture 08 Materialized View
9
 Refresh Method of Materialized Views
◦ Complete Refresh
◦ Fast Refresh
 Differential Refresh
 On Comitt
Lecture 08 Materialized View
10
 Materialized Views Log
◦ A materialized view log is required on a master if you want to perform a
fast refresh on materialized views based on the master. The log is used
to record changes to the master.
◦ For Example
CREATE MATERIALIZED VIEW LOG ON customer;
Lecture 08 Materialized View
11
 Materialized Views Log
◦ When DML changes are made to master table data, Oracle
Database stores rows describing those changes in the
materialized view log and then uses the materialized view
log to refresh materialized views based on the master table.
◦ This process is called incremental or fast refresh.
Lecture 08 Materialized View
12
 Materialized Views Log
◦ Behaviors of Materialized view by using:
 mlog$_tablename
 SELECT COUNT(*) FROM mlog$_tablename
 SELECT * FROM mlog$_tablename
Lecture 08 Materialized View
13
 Materialized Views Creation
◦ CREATE MATERIALIZED VIEW view_name
REFRESH FAST ON COMMIT AS
SELECT * FROM table_name;
Lecture 08 Materialized View
14
 Materialized Views Creation
desc user_snapshots
SELECT name, table_name, refresh_method
FROM user_snapshots;
Lecture 08 Materialized View
15
 Materialized Views Creation ON DEMAND
◦ CREATE MATERIALIZED VIEW view_name
REFRESH FAST ON DEMAND
AS SELECT * FROM table_name;
Lecture 08 Materialized View
16
 Materialized Views Creation ON DEMAND
◦ To reflect the changes of master table in
materialized view we have to execute following
code.
execute DBMS_MVIEW.REFRESH( ‘name_of_view' );
Lecture 08 Materialized View
17
 Materialized Views Creation using Refresh COMPLETE
◦ CREATE MATERIALIZED VIEW view_name
REFRESH COMPLETE
START WITH SYSDATE
NEXT SYSDATE + 1
AS SELECT * FROM table_name;
Lecture 08 Materialized View
18
 Materialized Views Creation Updatable
◦ CREATE MATERIALIZED VIEW view_name
for UPDATE
AS SELECT * FROM table_name;
Lecture 08 Materialized View
19
Have a Nice Day
Ad

More Related Content

What's hot (20)

Dbms architecture
Dbms architectureDbms architecture
Dbms architecture
Shubham Dwivedi
 
Packages in PL/SQL
Packages in PL/SQLPackages in PL/SQL
Packages in PL/SQL
Pooja Dixit
 
1.2 steps and functionalities
1.2 steps and functionalities1.2 steps and functionalities
1.2 steps and functionalities
Krish_ver2
 
Database System Architectures
Database System ArchitecturesDatabase System Architectures
Database System Architectures
Information Technology
 
DBMS ARCHITECTURE.pptx
DBMS ARCHITECTURE.pptxDBMS ARCHITECTURE.pptx
DBMS ARCHITECTURE.pptx
Anusha sivakumar
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database Design
Archit Saxena
 
PHP - Introduction to File Handling with PHP
PHP -  Introduction to  File Handling with PHPPHP -  Introduction to  File Handling with PHP
PHP - Introduction to File Handling with PHP
Vibrant Technologies & Computers
 
Schema
SchemaSchema
Schema
Pragya Srivastava
 
Data partitioning
Data partitioningData partitioning
Data partitioning
Vinod Wilson
 
Concurrency control!
Concurrency control!Concurrency control!
Concurrency control!
Ashish K
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
Chirag vasava
 
Query optimization
Query optimizationQuery optimization
Query optimization
Pooja Dixit
 
Postgresql
PostgresqlPostgresql
Postgresql
NexThoughts Technologies
 
Data Mining: Classification and analysis
Data Mining: Classification and analysisData Mining: Classification and analysis
Data Mining: Classification and analysis
DataminingTools Inc
 
SQL - Structured query language introduction
SQL - Structured query language introductionSQL - Structured query language introduction
SQL - Structured query language introduction
Smriti Jain
 
Data Warehousing and Data Mining
Data Warehousing and Data MiningData Warehousing and Data Mining
Data Warehousing and Data Mining
idnats
 
Store procedures
Store proceduresStore procedures
Store procedures
Farzan Wadood
 
Database User and Administrator
Database User and AdministratorDatabase User and Administrator
Database User and Administrator
A. S. M. Shafi
 
Data warehousing
Data warehousingData warehousing
Data warehousing
Shruti Dalela
 
Database , 4 Data Integration
Database , 4 Data IntegrationDatabase , 4 Data Integration
Database , 4 Data Integration
Ali Usman
 
Packages in PL/SQL
Packages in PL/SQLPackages in PL/SQL
Packages in PL/SQL
Pooja Dixit
 
1.2 steps and functionalities
1.2 steps and functionalities1.2 steps and functionalities
1.2 steps and functionalities
Krish_ver2
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database Design
Archit Saxena
 
Concurrency control!
Concurrency control!Concurrency control!
Concurrency control!
Ashish K
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
Chirag vasava
 
Query optimization
Query optimizationQuery optimization
Query optimization
Pooja Dixit
 
Data Mining: Classification and analysis
Data Mining: Classification and analysisData Mining: Classification and analysis
Data Mining: Classification and analysis
DataminingTools Inc
 
SQL - Structured query language introduction
SQL - Structured query language introductionSQL - Structured query language introduction
SQL - Structured query language introduction
Smriti Jain
 
Data Warehousing and Data Mining
Data Warehousing and Data MiningData Warehousing and Data Mining
Data Warehousing and Data Mining
idnats
 
Database User and Administrator
Database User and AdministratorDatabase User and Administrator
Database User and Administrator
A. S. M. Shafi
 
Database , 4 Data Integration
Database , 4 Data IntegrationDatabase , 4 Data Integration
Database , 4 Data Integration
Ali Usman
 

Viewers also liked (8)

Part 25 view vs. mv
Part 25 view vs. mvPart 25 view vs. mv
Part 25 view vs. mv
Girija Muscut
 
Part1 materialized view
Part1 materialized viewPart1 materialized view
Part1 materialized view
Girija Muscut
 
Sql query tuning or query optimization
Sql query tuning or query optimizationSql query tuning or query optimization
Sql query tuning or query optimization
Vivek Singh
 
Cloud architectural patterns and Microsoft Azure tools
Cloud architectural patterns and Microsoft Azure toolsCloud architectural patterns and Microsoft Azure tools
Cloud architectural patterns and Microsoft Azure tools
Pushkar Chivate
 
PostgreSQL Materialized Views with Active Record
PostgreSQL Materialized Views with Active RecordPostgreSQL Materialized Views with Active Record
PostgreSQL Materialized Views with Active Record
David Roberts
 
Knapsack Problem
Knapsack ProblemKnapsack Problem
Knapsack Problem
Jenny Galino
 
OracleMaterializedviews & Hierarchical Data
OracleMaterializedviews & Hierarchical DataOracleMaterializedviews & Hierarchical Data
OracleMaterializedviews & Hierarchical Data
Amit Sahoo
 
Part 20 comments on mv
Part 20 comments on mvPart 20 comments on mv
Part 20 comments on mv
Girija Muscut
 
Part1 materialized view
Part1 materialized viewPart1 materialized view
Part1 materialized view
Girija Muscut
 
Sql query tuning or query optimization
Sql query tuning or query optimizationSql query tuning or query optimization
Sql query tuning or query optimization
Vivek Singh
 
Cloud architectural patterns and Microsoft Azure tools
Cloud architectural patterns and Microsoft Azure toolsCloud architectural patterns and Microsoft Azure tools
Cloud architectural patterns and Microsoft Azure tools
Pushkar Chivate
 
PostgreSQL Materialized Views with Active Record
PostgreSQL Materialized Views with Active RecordPostgreSQL Materialized Views with Active Record
PostgreSQL Materialized Views with Active Record
David Roberts
 
OracleMaterializedviews & Hierarchical Data
OracleMaterializedviews & Hierarchical DataOracleMaterializedviews & Hierarchical Data
OracleMaterializedviews & Hierarchical Data
Amit Sahoo
 
Part 20 comments on mv
Part 20 comments on mvPart 20 comments on mv
Part 20 comments on mv
Girija Muscut
 
Ad

Similar to Lect 08 materialized view (20)

A presentationon SPRING-BOOT and CRUD operation
A presentationon SPRING-BOOT and CRUD operationA presentationon SPRING-BOOT and CRUD operation
A presentationon SPRING-BOOT and CRUD operation
AbhijiteDebBarman
 
Why oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cWhy oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19c
Satishbabu Gunukula
 
Accelerating query processing with materialized views in Apache Hive
Accelerating query processing with materialized views in Apache HiveAccelerating query processing with materialized views in Apache Hive
Accelerating query processing with materialized views in Apache Hive
DataWorks Summit
 
Oracle BIEE - Everything you always wanted to know about cache
Oracle BIEE - Everything you always wanted to know about cacheOracle BIEE - Everything you always wanted to know about cache
Oracle BIEE - Everything you always wanted to know about cache
Rick Brobbel
 
best snowflake training in Hyderabad 100% job Assistance
best snowflake training in Hyderabad 100% job Assistancebest snowflake training in Hyderabad 100% job Assistance
best snowflake training in Hyderabad 100% job Assistance
arvinittechnologytea
 
Iphone programming: Core Data Tutorial for iOS
Iphone programming: Core Data Tutorial for iOSIphone programming: Core Data Tutorial for iOS
Iphone programming: Core Data Tutorial for iOS
Kenny Nguyen
 
MySQL Cluster Asynchronous replication (2014)
MySQL Cluster Asynchronous replication (2014) MySQL Cluster Asynchronous replication (2014)
MySQL Cluster Asynchronous replication (2014)
Frazer Clement
 
Disaster Recovery Infrastructure Whitepaper 2012
Disaster Recovery Infrastructure Whitepaper 2012Disaster Recovery Infrastructure Whitepaper 2012
Disaster Recovery Infrastructure Whitepaper 2012
Jade Global
 
Getting Most Out of Your Disaster Recovery Infrastructure Using Active Data G...
Getting Most Out of Your Disaster Recovery Infrastructure Using Active Data G...Getting Most Out of Your Disaster Recovery Infrastructure Using Active Data G...
Getting Most Out of Your Disaster Recovery Infrastructure Using Active Data G...
Jade Global
 
Oracle database 12c sql worshop 2 student guide vol 2
Oracle database 12c sql worshop 2 student guide vol 2Oracle database 12c sql worshop 2 student guide vol 2
Oracle database 12c sql worshop 2 student guide vol 2
Otto Paiz
 
Oracle 12 c new-features
Oracle 12 c new-featuresOracle 12 c new-features
Oracle 12 c new-features
Navneet Upneja
 
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (1/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (1/3)[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (1/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (1/3)
Carles Farré
 
Mirroring in SQL Server 2012 R2
Mirroring in SQL Server 2012 R2Mirroring in SQL Server 2012 R2
Mirroring in SQL Server 2012 R2
Mahesh Dahal
 
Remote DBA Experts 11g Features
Remote DBA Experts 11g FeaturesRemote DBA Experts 11g Features
Remote DBA Experts 11g Features
Remote DBA Experts
 
Database ppt[}}.pptx database system and
Database ppt[}}.pptx database system andDatabase ppt[}}.pptx database system and
Database ppt[}}.pptx database system and
itxdevilmehar
 
Accelerating query processing
Accelerating query processingAccelerating query processing
Accelerating query processing
DataWorks Summit
 
Accelerating query processing with materialized views in Apache Hive
Accelerating query processing with materialized views in Apache HiveAccelerating query processing with materialized views in Apache Hive
Accelerating query processing with materialized views in Apache Hive
Sahil Takiar
 
Model viewviewmodel2
Model viewviewmodel2Model viewviewmodel2
Model viewviewmodel2
Suraj Kulkarni
 
Oracle database 12c sql worshop 2 student guide vol 1
Oracle database 12c sql worshop 2 student guide vol 1Oracle database 12c sql worshop 2 student guide vol 1
Oracle database 12c sql worshop 2 student guide vol 1
Otto Paiz
 
Data Build Tool Training | DBT Training
Data Build Tool Training |  DBT TrainingData Build Tool Training |  DBT Training
Data Build Tool Training | DBT Training
susheel visualpath
 
A presentationon SPRING-BOOT and CRUD operation
A presentationon SPRING-BOOT and CRUD operationA presentationon SPRING-BOOT and CRUD operation
A presentationon SPRING-BOOT and CRUD operation
AbhijiteDebBarman
 
Why oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cWhy oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19c
Satishbabu Gunukula
 
Accelerating query processing with materialized views in Apache Hive
Accelerating query processing with materialized views in Apache HiveAccelerating query processing with materialized views in Apache Hive
Accelerating query processing with materialized views in Apache Hive
DataWorks Summit
 
Oracle BIEE - Everything you always wanted to know about cache
Oracle BIEE - Everything you always wanted to know about cacheOracle BIEE - Everything you always wanted to know about cache
Oracle BIEE - Everything you always wanted to know about cache
Rick Brobbel
 
best snowflake training in Hyderabad 100% job Assistance
best snowflake training in Hyderabad 100% job Assistancebest snowflake training in Hyderabad 100% job Assistance
best snowflake training in Hyderabad 100% job Assistance
arvinittechnologytea
 
Iphone programming: Core Data Tutorial for iOS
Iphone programming: Core Data Tutorial for iOSIphone programming: Core Data Tutorial for iOS
Iphone programming: Core Data Tutorial for iOS
Kenny Nguyen
 
MySQL Cluster Asynchronous replication (2014)
MySQL Cluster Asynchronous replication (2014) MySQL Cluster Asynchronous replication (2014)
MySQL Cluster Asynchronous replication (2014)
Frazer Clement
 
Disaster Recovery Infrastructure Whitepaper 2012
Disaster Recovery Infrastructure Whitepaper 2012Disaster Recovery Infrastructure Whitepaper 2012
Disaster Recovery Infrastructure Whitepaper 2012
Jade Global
 
Getting Most Out of Your Disaster Recovery Infrastructure Using Active Data G...
Getting Most Out of Your Disaster Recovery Infrastructure Using Active Data G...Getting Most Out of Your Disaster Recovery Infrastructure Using Active Data G...
Getting Most Out of Your Disaster Recovery Infrastructure Using Active Data G...
Jade Global
 
Oracle database 12c sql worshop 2 student guide vol 2
Oracle database 12c sql worshop 2 student guide vol 2Oracle database 12c sql worshop 2 student guide vol 2
Oracle database 12c sql worshop 2 student guide vol 2
Otto Paiz
 
Oracle 12 c new-features
Oracle 12 c new-featuresOracle 12 c new-features
Oracle 12 c new-features
Navneet Upneja
 
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (1/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (1/3)[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (1/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (1/3)
Carles Farré
 
Mirroring in SQL Server 2012 R2
Mirroring in SQL Server 2012 R2Mirroring in SQL Server 2012 R2
Mirroring in SQL Server 2012 R2
Mahesh Dahal
 
Remote DBA Experts 11g Features
Remote DBA Experts 11g FeaturesRemote DBA Experts 11g Features
Remote DBA Experts 11g Features
Remote DBA Experts
 
Database ppt[}}.pptx database system and
Database ppt[}}.pptx database system andDatabase ppt[}}.pptx database system and
Database ppt[}}.pptx database system and
itxdevilmehar
 
Accelerating query processing
Accelerating query processingAccelerating query processing
Accelerating query processing
DataWorks Summit
 
Accelerating query processing with materialized views in Apache Hive
Accelerating query processing with materialized views in Apache HiveAccelerating query processing with materialized views in Apache Hive
Accelerating query processing with materialized views in Apache Hive
Sahil Takiar
 
Oracle database 12c sql worshop 2 student guide vol 1
Oracle database 12c sql worshop 2 student guide vol 1Oracle database 12c sql worshop 2 student guide vol 1
Oracle database 12c sql worshop 2 student guide vol 1
Otto Paiz
 
Data Build Tool Training | DBT Training
Data Build Tool Training |  DBT TrainingData Build Tool Training |  DBT Training
Data Build Tool Training | DBT Training
susheel visualpath
 
Ad

Recently uploaded (20)

Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
Operations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdfOperations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdf
Arab Academy for Science, Technology and Maritime Transport
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
SPRING FESTIVITIES - UK AND USA -
SPRING FESTIVITIES - UK AND USA            -SPRING FESTIVITIES - UK AND USA            -
SPRING FESTIVITIES - UK AND USA -
Colégio Santa Teresinha
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Library Association of Ireland
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Library Association of Ireland
 

Lect 08 materialized view

  • 1. Lecture 08 Materialized View Department of Computer Science Kardan University Materialized View Lec-08 Prepared by Bilal Khan
  • 2. Lecture 08 Materialized View 2  A materialized view (MV) is a database object that stores the results of a query at a single point in time. Unlike a view, materialized view is not virtual.  Materialized views are sometimes referred to as snapshots.  Materialized views may be stored locally or remotely in other site.
  • 3. Lecture 08 Materialized View 3  Increase query performance since it contains results of a query.  Remote materialized views are an efficient way to replicate data at different sites compared to fully consistent distributed data. ◦ Do not require dedicated network connection and network load is reduced. ◦ Efficiently support remote users
  • 4. Lecture 08 Materialized View 4  Materialized View Management ◦ Define materialized view ◦ Refresh materialized view  Data of a materialized view may be out-of-date and require to be refreshed. ◦ Drop materialized view
  • 5. Lecture 08 Materialized View 5  Basic Syntax CREATE MATERIALIZED VIEW view-name BUILD [IMMEDIATE | DEFERRED] REFRESH [FAST | COMPLETE | FORCE ] ON [COMMIT | DEMAND ] [ON PREBUILT TABLE] AS SELECT ...;
  • 6. Lecture 08 Materialized View 6  Types of Materialized Views ◦ Read-Only Materialized Views ◦ Updatable Materialized Views
  • 7. Lecture 08 Materialized View 7  Types of Materialized Views ◦ Read-Only Materialized Views ◦ Records in the MV cannot be changed by users. ◦ Eliminates the possibility of a materialized view introducing data conflicts with the master (base tables).
  • 8. Lecture 08 Materialized View 8  Types of Materialized Views ◦ Updatable Materialized Views ◦ Users can make changes to the data at the materialized view site. ◦ Changes made to an updatable materialized view are pushed back to the master during refresh.
  • 9. Lecture 08 Materialized View 9  Refresh Method of Materialized Views ◦ Complete Refresh ◦ Fast Refresh  Differential Refresh  On Comitt
  • 10. Lecture 08 Materialized View 10  Materialized Views Log ◦ A materialized view log is required on a master if you want to perform a fast refresh on materialized views based on the master. The log is used to record changes to the master. ◦ For Example CREATE MATERIALIZED VIEW LOG ON customer;
  • 11. Lecture 08 Materialized View 11  Materialized Views Log ◦ When DML changes are made to master table data, Oracle Database stores rows describing those changes in the materialized view log and then uses the materialized view log to refresh materialized views based on the master table. ◦ This process is called incremental or fast refresh.
  • 12. Lecture 08 Materialized View 12  Materialized Views Log ◦ Behaviors of Materialized view by using:  mlog$_tablename  SELECT COUNT(*) FROM mlog$_tablename  SELECT * FROM mlog$_tablename
  • 13. Lecture 08 Materialized View 13  Materialized Views Creation ◦ CREATE MATERIALIZED VIEW view_name REFRESH FAST ON COMMIT AS SELECT * FROM table_name;
  • 14. Lecture 08 Materialized View 14  Materialized Views Creation desc user_snapshots SELECT name, table_name, refresh_method FROM user_snapshots;
  • 15. Lecture 08 Materialized View 15  Materialized Views Creation ON DEMAND ◦ CREATE MATERIALIZED VIEW view_name REFRESH FAST ON DEMAND AS SELECT * FROM table_name;
  • 16. Lecture 08 Materialized View 16  Materialized Views Creation ON DEMAND ◦ To reflect the changes of master table in materialized view we have to execute following code. execute DBMS_MVIEW.REFRESH( ‘name_of_view' );
  • 17. Lecture 08 Materialized View 17  Materialized Views Creation using Refresh COMPLETE ◦ CREATE MATERIALIZED VIEW view_name REFRESH COMPLETE START WITH SYSDATE NEXT SYSDATE + 1 AS SELECT * FROM table_name;
  • 18. Lecture 08 Materialized View 18  Materialized Views Creation Updatable ◦ CREATE MATERIALIZED VIEW view_name for UPDATE AS SELECT * FROM table_name;
  • 19. Lecture 08 Materialized View 19 Have a Nice Day

Editor's Notes

  • #6: BUILD clause options are shown below. IMMEDIATE : The materialized view is populated immediately. DEFERRED : The materialized view is populated on the first requested refresh. The following refresh types are available. FAST : A fast refresh is attempted. If materialized view logs are not present against the source tables in advance, the creation fails. COMPLETE : The table segment supporting the materialized view is truncated and repopulated completely using the associated query. FORCE : A fast refresh is attempted. If one is not possible a complete refresh is performed. A refresh can be triggered in one of two ways. ON COMMIT : The refresh is triggered by a committed data change in one of the dependent tables. ON DEMAND : The refresh is initiated by a manual request or a scheduled task. The ON PREBUILT TABLE clause tells the database to use an existing table segment, which must have the same name as the materialized view and support the same column structure as the query.