creating materialized view in ibm i series

Posted on 2016-10-04
Last Modified: 2016-11-03
We want to create materialized view in IBM i series v7R1 instead of normal views as we are having performance issue. Could anyone let us know how to create & maintain materialized view .
Question by:Syed Shareef Ahmed
  • 2
  • 2
LVL 18

Assisted Solution

daveslash earned 250 total points
ID: 41828893
From what you say in the question, it appears that you've successfully created the view, but you're experiencing some sort of "performance issue". Is that correct?

Would you please provide us with more details, such as the source for the view and deails of the performance issue?

LVL 35

Accepted Solution

Gary Patterson earned 250 total points
ID: 41829998
Are you sure you want to use a MQT?

At the moment, in IBM i DB2 though V7R3, MQTs are "point in time" snapshots - they are not dynamically updated as rows are inserted/updated/deleted in the underlying tables (MAINTAINED BY USER is the only maintenance option at create time).

As a result, they are generally only appropriate in systems where the dependent tables are undated infrequently - a data warehouse that is just updated once a day is the classic case, or where a point in time snapshot is acceptable.

Here's how to create them and maintain them:

Author Comment

by:Syed Shareef Ahmed
ID: 41830500
Hi DaveSlash,

Thanks for the response.

Yes your are very correct we have successfully created some views from tables (file) and used in some of reports with those views. The reports are taking time to run but not always, some time it runs fine and other time it takes time. Those reports are also used by our customers through web.

so we thought to create  materialize view.

LVL 35

Expert Comment

by:Gary Patterson
ID: 41830848
Inconsistent query runtimes can have a number of causes, for example:

1) A major table could be substantially cached in memory from a previous query, causing occasional runs to be artificially fast.  We run into this when we're doing performance testing, and run similar tests back-to-back.  To get a true "cold cache" runtime, we have to clear memory pools before running the test to get a good comparative value.

2) Users may be making different selections in the application interface that cause substantially large queries - for example, if they can enter a date range.

3) System load may vary over time.  Contention for CPU, memory, disk resources, etc. can cause wide variations in query runtime performance.

If I was working on this problem, I'd capture some performance data and do a little investigation:

Determine time periods where same query performs well, and when it takes longer.  You might be able to just pull this from the DB2 SQL Plan Cache.  While you're at it look and see if there are indexes advised for the query, and look for other optimization opportunities for the problem query.

Look at Collection Services or iDoctor Job Watcher data from same period to see if you can correlate longer runtimes to high CPU, high disk busy %, etc.

IBM i DB2 Database Performance and Query Optimization manual has a lot of good info on analyzing and resolving performance problems like this:


- Gary

Author Closing Comment

by:Syed Shareef Ahmed
ID: 41871939
Thanks a lot all :)

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
Recursive SQL in UDB/LUW (you can use 'recursive' and 'SQL' in the same sentence) A growing number of database queries lend themselves to recursive solutions.  It's not always easy to spot when recursion is called for, especially for people una…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit If you want to manage em…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question