OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Database

SQL - V4.3.5

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive DemosTraining & Certification
    Company
    About OceanBaseTrust CenterLegalPartnerContact Us
    Follow Us

    © OceanBase 2026. All rights reserved

    Cloud Service AgreementPrivacy PolicySecurity
    Contact Us
    Document Feedback
    1. Documentation Center
    2. OceanBase Database
    3. SQL
    4. V4.3.5
    iconOceanBase Database
    SQL - V 4.3.5
    SQL
    KV
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    Query materialized views

    Last Updated:2026-04-09 02:53:55  Updated
    share
    What is on this page
    Query the definition of a materialized view
    Query information about materialized views by using views
    References

    folded

    share

    This topic describes how to query materialized views.

    Query the definition of a materialized view

    You can execute the SHOW CREATE TABLE statement to query the definition of a materialized view.

    Here is an example:

    Query the definition of the materialized view mv_tbl1.

    SHOW CREATE TABLE mv_tbl1;
    

    The return result is as follows:

    +---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
    | View    | Create View                                                                                                                                                                                                                                                                                                                                                                      | character_set_client | collation_connection |
    +---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
    | mv_tbl1 | CREATE MATERIALIZED VIEW `mv_tbl1` DEFAULT CHARSET = utf8mb4 ROW_FORMAT = DYNAMIC COMPRESSION = 'zstd_1.3.8' REPLICA_NUM = 1 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 10 REFRESH FORCE ON DEMAND  AS select `db_test`.`tbl1`.`col1` AS `col1`,`db_test`.`tbl1`.`col2` AS `col2` from `db_test`.`tbl1` where (`db_test`.`tbl1`.`col3` >= 20) | utf8mb4              | utf8mb4_general_ci   |
    +---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
    1 row in set
    

    Query information about materialized views by using views

    You can query information about materialized views by using the following views:

    View Description
    DBA_MVIEWS Displays information about materialized views.
    DBA_MVREF_STATS_SYS_DEFAULTS Displays the system default values of refresh statistics attributes for materialized views.
    DBA_MVREF_STATS_PARAMS Displays the refresh statistics attributes associated with each materialized view.
    DBA_MVREF_RUN_STATS Displays information about each refresh run of a materialized view, which is identified by the REFRESH_ID.
    DBA_MVREF_STATS Displays basic timing statistics about materialized view refreshes.
    DBA_MVREF_CHANGE_STATS Displays statistics about materialized view refreshes.
    DBA_MVREF_STMT_STATS Displays information about refresh statements.
    DBA_SCHEDULER_JOBS Displays information about all scheduler jobs in the database.

    Here is an example:

    Query the background refresh task of the automatically refreshed materialized view mv_rc_swn1_tbl1 by using the DBA_SCHEDULER_JOBS view.

    SELECT JOB_NAME,JOB_ACTION,START_DATE,REPEAT_INTERVAL,LAST_START_DATE,NEXT_RUN_DATE
    FROM oceanbase.DBA_SCHEDULER_JOBS
    WHERE JOB_ACTION like "%mv_rc_swn1_tbl1%";
    

    The return result is as follows:

    +----------------------------------+----------------------------------------------------------------------+----------------------------+--------------------------------+----------------------------+----------------------------+
    | JOB_NAME                         | JOB_ACTION                                                           | START_DATE                 | REPEAT_INTERVAL                | LAST_START_DATE            | NEXT_RUN_DATE              |
    +----------------------------------+----------------------------------------------------------------------+----------------------------+--------------------------------+----------------------------+----------------------------+
    | MVIEW_REFRESH$J_1125899908922625 | DBMS_MVIEW.refresh('db_test.mv_rc_swn1_tbl1', refresh_parallel => 1) | 2024-12-17 17:54:54.000000 | sysdate() + interval 30 minute | 2024-12-18 09:24:57.006246 | 2024-12-18 09:54:57.000000 |
    +----------------------------------+----------------------------------------------------------------------+----------------------------+--------------------------------+----------------------------+----------------------------+
    1 row in set
    

    References

    • Overview of materialized views
    • Materialized view logs
    • Create materialized views
    • Refresh materialized views
    • Query rewriting for materialized views
    • Drop materialized views

    Previous topic

    Rewrite queries based on materialized views
    Last

    Next topic

    Modify the attributes of a materialized view
    Next
    What is on this page
    Query the definition of a materialized view
    Query information about materialized views by using views
    References