Questions tagged [materialized-view]

Defined like a view but holding persistent data like a table, Materialized Views are a feature of a number of RDBMSs including Oracle, DB2 and postgres. SQL Server has a similar feature called an Indexed View that is considered similar enough to come under this tag.

Filter by
Sorted by
Tagged with
0 votes
0 answers
42 views

Refreshing Materialized Views Taking Longer After PostgreSQL Upgrade

I have upgraded a PostgreSQL instance from 10 to 13 using pg_upgrade. Though I analyzed the databases but the Materialized Views I have are taking longer to refresh than before. For some of these ...
user avatar
0 votes
0 answers
70 views

Populate materialized view based on inherited ltree relations

I am trying to create a materialized view that populates the inherited relations of a ltree. Assuming we have 3 tables: hierarchy --- id: int name: text path: ltree user --- id: int name: text ...
user avatar
  • 101
1 vote
2 answers
23 views

Problem with Oracle Job Scheduling

I have a job that refreshes a materialised view refresh group on Oracle 19c. I wanted to refresh the group daily at midnight - trunc(sysdate)? The job was made using using the following PL/SQL: ...
user avatar
  • 137
0 votes
0 answers
36 views

Refresh materialized view on Postgresql 11 on RDS

We are currently on Postgres 11.13 on AWS RDS. I am trying to create a materialized view that takes about 6-7 minutes to run. What is the best way to keep this MV mostly up to date? I was thinking of ...
user avatar
  • 101
0 votes
1 answer
25 views

postgresql : conflict with simultaneous "create materialized view"

This is a continuation on my old question Multiple concurrent "REFRESH MATERIALIZED VIEW": how to manage? Now I'm unfortunately struggling with the real thing after having been more ...
user avatar
  • 115
1 vote
1 answer
80 views

Naming conventions for views and materialized views: "*_v", "v_*", "*_mv", "mv_*" or none? [closed]

My view stores quality metrics for various gizmos1 in the database. Today I designed it to be a view. In a few years, as we produce more gizmos, it may need to be changed to a materialized view. I was ...
user avatar
0 votes
0 answers
107 views

Postgres materialized view: no performance gain

I've created a materialized view to cache results of joining about 15 tables. Unfortunately, select * from mv_cache takes the same amount of time as the original joins. Am I doing anything wrong? ...
user avatar
0 votes
1 answer
65 views

PostgreSQL : Refresh a materialized view base on a foreign table

I've got a foreign table from a distant csv host on a external webserver. I need to enhance this table so I create a materialized view to add some extra fields and join with internal data. Making a ...
user avatar
0 votes
0 answers
88 views

Materialized view creates quickly with data but cannot refresh

I am working with a database on Amazon RDS and have a specific query which joins about 6 tables on keys. Creating the materialised view with data takes about 3 minutes and behaves as expected with ...
user avatar
1 vote
1 answer
26 views

List Postgres materialized views the current user has select grant

With select matviewname from pg_matviews I get all materialized views in the database. How can I filter the result to get only those the current user has select grant (= read permission) on?
user avatar
  • 113
4 votes
1 answer
123 views

Indexed view maintenance with foreign key not elided when inserting parent row

TL;DR; Given an indexed view that has a JOIN between two tables that already have a foreign key relationship along with a WHERE predicate on the parent table. When inserting into the parent table of ...
user avatar
  • 5,214
1 vote
1 answer
87 views

Oracle multithreaded JDBC bulk select high-performance data export

The goal of our solution is to export as fast as possible CLOB data from an events table. The concept is to logically partition the data with a partition_id column such that every thread from the ...
user avatar
  • 11
2 votes
1 answer
219 views

postgresql materialized view ERROR: a negative number raised to a non-integer power yields a complex result

I have complex view with calculations but one line makes issue ROUND((((latest_revenue::numeric/ oper_reve_3y_old::numeric) ^ (1/3::numeric)) -1::numeric)*100::numeric) When I execute the query, ...
user avatar
  • 123
0 votes
0 answers
87 views

RDS Postgres Aurora concurrent materialized view performance tuning advice

I am trying to modify instance settings to speed up a slow running concurrent materialized view refresh. I am increasing maintenance_work_mem and work_mem in session, but these seem to have no effect. ...
user avatar
  • 273
0 votes
0 answers
355 views

Oracle mview refresh taking long time

the customer I work for is used to launch a script to refresh mviews on its db. Refresh command for all mviews is issued in the following way: DBMS_MVIEW.refresh('"OWNER"."MVIEW"','...
user avatar
0 votes
0 answers
173 views

How can I exclude Materialised Views from a pg_dump

I'm doing a pg_dump of an AWS RDS database so I can use it for local development, but there are some large tables I want to exclude. I've successfully removed them using the --exclude-table=blah* flag ...
user avatar
0 votes
3 answers
199 views

Quering millions of rows is still slow with index and a materialized view

The system has 4 tables that are joined to get a lot of data about users, this query was turned into a view with 37 columns and a total of ~8 million rows. Eventually this became slow due to a user ...
user avatar
0 votes
1 answer
149 views

Postgres metadata: get a list of all MATERIALIZED VIEW columns, with data type, INCLUDING array columns

I need to get metadata about all MATERIALIZED VIEW columns, including their data type. I can do this with this query: SELECT trim(leading '_' from pg_type.typname) as data_type, pg_namespace....
user avatar
  • 203
0 votes
1 answer
20 views

List sorted Posts on Group and children Groups efficiently

Say I have a system that has Groups and Posts on those Groups. A Group can have multiple "child Groups" Group 1 > Group 2 > Group 3 Group 1 > Group 2 > Group 4 Group 1 > ...
user avatar
  • 599
0 votes
0 answers
95 views

Oracle Materialized Views best practice for refresh

I have the following nested MVs order: tab1 tab2 tab3 |----> MV join the 3 tables | |-----> MV aggregate | |------> MV aggregate | |--...
user avatar
  • 373
3 votes
1 answer
385 views

Is vacuuming a PostgreSQL materialized view necessary?

I understand it makes sense to analyze a Materialized View (MV), but since MVs are not updateable, does that imply that we need not ever vacuum a MV?
user avatar
0 votes
0 answers
111 views

Convert jsonb column into view for Grafana

I have a partially dynamic data that I have to save into Postgres 13 and then visualize it in Grafana. Example for one document insert (partial) { "Timestamp": { "$date": { ...
user avatar
  • 11
0 votes
1 answer
295 views

Need help understanding Postgres materialized views under the hood

postgres 9.6.20 Need some help getting an accurate mental model of whats happening with postgres materialized views. Based on this from postgres docs (https://www.postgresql.org/docs/9.6/rules-...
user avatar
  • 103
2 votes
3 answers
55 views

Preserving full refresh data source

I have a SQL Server database that gets updated every week with a completely new set of data. I am currently using two staging databases. A series of view databases are connecting to these and one week ...
user avatar
1 vote
2 answers
215 views

Oracle MV requires object type to be defined as FINAL?

I want to create an Oracle 18c materialized view (MV) on a table that has a user-defined datatype called ST_GEOMETRY: The MV would do a COMPLETE refresh on a schedule — on a local table. Some info ...
user avatar
  • 1,373
-1 votes
2 answers
497 views

What is the correct way to do a computed column with complex logic with performant sorting and filtering at scale in MS SQL Server? [closed]

I'll provide a toy example here: I have 2 tables, a Thing table and an AdditionGroup table. Things may be members of an AdditionGroup, or they may not. Both Thing and AdditionGroup have a Quantity ...
user avatar
  • 132
0 votes
0 answers
430 views

Can't refresh Materialized View Concurrently

I'm trying to run REFRESH MATERIALIZED view CONCURRENTLY my_view in Postgresql, and I'm getting the following error: SQL Error [XX000]: ERROR: unexpected attlen: -2 Where: SQL statement "SELECT ...
user avatar
  • 101
0 votes
1 answer
901 views

Postgres SQL: View with a nested table

I have 2 tables users & groups: user_id | title group_id | title ---------------- ------------------ U_1 | User 1 G_1 | Group 1 U_2 | User 2 G_2 | ...
user avatar
5 votes
1 answer
347 views

Updating an indexed view with NOEXPAND

I will preface this by saying that this is a cross post from an unanswered question on Stack Overflow. I am not doing this simply to get more views on the question, I would like the DBA community to ...
user avatar
  • 5,214
0 votes
2 answers
85 views

Report based on MV: Deliberately make the report fail if MV is out of date?

I have a query that is used in a BIRT report (in IBM's Maximo Asset Management platform). I'm considering storing the query in a materialized view in order to improve performance and reduce the load ...
user avatar
  • 1,373
0 votes
1 answer
33 views

MV on remote/master table fails to resume syncing (after master db host was temporarily unreachable)

I have a fast-refresh materialized view in a target db (18c) that syncs from a remote table/master db (19c): --master db (19c) create materialized view log on master.workorder with primary key; --...
user avatar
  • 1,373
7 votes
2 answers
325 views

Indexed view not used in actual execution plan?

I've got a modest use case for an indexed view, which collapses out a column and sums all entries from a large table: CREATE VIEW dbo.Losses_CombinedPortfolio WITH SCHEMABINDING AS SELECT [...
user avatar
  • 173
0 votes
2 answers
367 views

Materialized view with FAST refresh on remote table: How to include a GEOMETRY column?

I want to create a fast refresh materialized view (18c) on a remote table. The MV would also have a GEOMETRY column. Options for the GEOMETRY column datatype include: ESRI's proprietary ...
user avatar
  • 1,373
1 vote
2 answers
196 views

Materialized View: What is the Update Trigger property?

I've created a materialized view in an Oracle 18c database. When I look at the Info tab of the materialized view in Toad, I see that there is a property called Update Trigger. What does the Update ...
user avatar
  • 1,373
0 votes
1 answer
489 views

Create fast-refresh MV over dblink on table without PK?

I want to create a materialized view between a primary system (Oracle 18c) and an external system (Oracle 19c) via a dblink. The MV would refresh on a 30-second schedule (since on-commit is not ...
user avatar
  • 1,373
1 vote
1 answer
103 views

Why am I able to create MV logs using PK — even though there is no PK?

I have a table that does not have a primary key: I'm able to create MV logs on the table — without specifying whether to use the primary key or the rowid: create materialized view log on maximo....
user avatar
  • 1,373
0 votes
1 answer
114 views

Materialized view logs — with condition?

I've created materialized view logs on a WORKORDER table in an Oracle 19c database. create materialized view log on my_workorder_system.workorder with rowid; The plan is to integrate the WORKORDER ...
user avatar
  • 1,373
0 votes
1 answer
427 views

Materialized view not purging (over dblink via view)

I've created a materialized view between a primary system (Oracle 18c) and an external system (Oracle 19c): create materialized view primary_system.workorder_mv build immediate refresh force on ...
user avatar
  • 1,373
8 votes
2 answers
352 views

Inability to query underlying table of a schema-bound view

I migrated a database from SQL Server 2008R2 to SQL Server 2019 (both Enterprise Edition) using the backup-restore technique, and a set of post-transfer actions like DBCC UPDATEUSAGE or UPDATE ...
user avatar
1 vote
1 answer
227 views

Why does my execution plan show a Clustered Index Scan is occurring when using an index hint that specifically uses a Nonclustered Index?

The Backstory: I have a table with the following structure: CREATE TABLE WideTable1 ( BoringColumn1, BoringColumn2, CellPhoneNumberColumn Phone(VARCHAR(20)), -- User-defined types, see ...
user avatar
  • 24.2k
1 vote
0 answers
405 views

Force select * in postgres materialized view definition

I have a Postgres database and a family of materialised views defined as clones of tables, used for testing and analysis of data so the data won't change during the testing/analysis process like: ...
user avatar
0 votes
1 answer
646 views

What does Oracle impdp do when a name clashes with a materialized view or synonym?

I have a production Oracle database, and I want to export tables, data, views, materialized views, synonyms, etc, to import into a development Oracle database. Actually, this is part of my job, and we ...
user avatar
  • 101
4 votes
1 answer
1k views

Postgresql: Refreshing materialized view fails with "No space left on device" and a huge spike in disk usage

I have a materialized view that refreshes every five minutes. The SQL aggregates the data among many tables with over 800k rows in each. However, the when using the "REFRESH MATERIALIZED VIEW ...
user avatar
  • 57
0 votes
1 answer
352 views

How do I force a Writable Materialized View instead of an Updatable one?

How do I ensure that an Oracle Materialized View is created as a "Writeable" materialized view and not as an "Updatable" one? I never want these views to push data back to the ...
user avatar
0 votes
2 answers
2k views

Materialized view in SQL Server

Have a bit of glitches from the time I was using SQL Server back in 2006 and the many other databases I played with (and which I have not touched since then). I need to create a materialized view to ...
user avatar
0 votes
0 answers
655 views

TSQL Materiaized/Indexed View Cluster index with subquery

I have two tables: Listings and Media and Media is a child of Listings. I am trying to create a indexed view that will include the first record from Media. I would also like to index my view so that ...
user avatar
  • 325
0 votes
1 answer
847 views

What permissions are required for complex cross-schema materialized view in Oracle?

I have a complex cross-schema query that I'd like to create as a materialized view in Oracle 19c (although the database has been ported forward from numerous historical versions of Oracle). This ...
user avatar
  • 201
1 vote
1 answer
575 views

Kill concurrent materialized view refresh PID

Concurrent refreshes of materialized views don't have a record in pg_stat_activity, other than the initial (~immediately completing) query to start them. Is there some other way to obtain the PID, in ...
user avatar
  • 113
0 votes
1 answer
1k views

Converting rows to columns using crosstab in PostgreSQL not working (relation "table" does not exist)

I need to use the compiled data using CTE and then convert the columns to rows using crosstab(open to other ideas) in the next select statement. Below is the query. with checked_adgroup AS ( ...
user avatar
1 vote
1 answer
30 views

Caching derived dataset automatically in SQL Server

I have a view that combines multiple tables via UNION ALL, and handles some basic errors with the data. Due to the way that the errors are handled, the view is a bit slower than I would hope. Is there ...
user avatar
  • 277

1
2 3 4 5 6