Hi, I have a Cloud SQL database running on PostgreSQL 17. I'm testing out some features, and one of these is materialized views. They work, but are not visible in the UI.
First, I create the materialized view from an existing table:
CREATE MATERIALIZED VIEW ris_metadata.processed_file_history_view AS
SELECT *
FROM ris_metadata.processed_file_history
LIMIT 1000
WITH DATA;
After that, I can query and select from this table properly:
SELECT * FROM ris_metadata.processed_file_history_view
record_idfile_pathstaging_table_sinkcreated_timeprocessed_timesuccessmessage
261 | sandbox-dev-environment-419308-landing-zone/new/c_study_x_prior/2025/03/25/c_study_x_prior_20250325_104521.parquet | ris_staging_data.staging_c_study_x_prior | 2025-03-25T10:45:22.598Z | 2025-03-25T10:57:03.24264Z | true | ||
etc., this works and is what I expect.
The problem here is that I want users who don't have full knowledge to be able to explore the database.
The above picture shows that no views, materialized or not, are available in this schema, despite being able to select them.
SELECT * FROM pg_matviews
WHERE schemaname = 'ris_metadata';
also returns
schemanamematviewnamematviewownertablespacehasindexesispopulateddefinition
ris_metadata | processed_file_history_view | postgres | false | true | SELECT record_id, file_path, staging_table_sink, created_time, processed_time, success, message... |
So I expect to see the view.
If anyone has any idea whether this is a feature of a bug, please let me know, I'd love to be able to also see the Materialized Views in the UI.
Bonus: Normal views do sho
The issue you're experiencing Postgres materialized views not showing up in the Cloud SQL UI is a known UI limitation rather than a bug.
Currently, the Cloud SQL Explorer only displays standard views (from pg_views) and doesn't recognize materialized views (from pg_matviews), though your materialized view exists and functions correctly, as confirmed by your queries.
Practical workarounds include directly querying pg_matviews, using external tools like pgAdmin or DBeaver, or maintaining separate documentation listing materialized views.
Hi @g_kolpa,
In addition to @ms4446’s thorough response, you might also want to check out the pg_ivm
extension. This extension enables you to make materialized views up-to-date in which only incremental changes are computed and applied on views rather than recomputing the contents from scratch. To set up the extension, see Configure PostgreSQL extensions.
If you prefer to use external database tools as a workaround, refer to these resources to help you integrate them with Google Cloud:
Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.