Quote:
|
Originally Posted by nagbuchi
#1.MQT uses write locks and also consumes extra space on the disk.We don't have enough space on the disk (I was told to create 60views on large tables).
|
What do you mean with "MQT uses write locks"?
An MQT is like any other table. Thus, if data in that table is changed for whatever reason, DB2 must lock the changed data. If someone reads data from that table, DB2 must lock the data being read (unless UNCOMMITTED READ is used).
Quote:
|
#2.As per our organization standards,we should not create triggers and should not grant insert,update,delete permissions on a view.
|
If you don't grant INSERT, UPDATE, or DELETE on views, why do you bother with making read-only views in the first place?
I didn't want to imply that you should use triggers for anything. I only tried to explain the situation. For example, If I wouldn't have mentioned INSTEAD OF triggers on views, someone may have jumped in and claimed that those views are not truly read-only.
Quote:
|
If there is no way to prevent the locks,I will use the straight forward way(just grant SELECT permission) to create read-only views.
|
Think about it: a view is just like a macro and it gets compiled into the query. Therefore, each query against a view will (in the end) always query the underlying table. And because DB2 must ensure the data integrity, it has to use locks to synchronize the access to a table. Put both together, and it is obvious that a view can't have any influence on the locking behavior.