Input: R ( A i , A 2 , , A m ) : The relation; Q = { Q 1 , Q 2 , , Q n } : The set of user queries that will run on R; cut-off: Cut-off Average Similarity .

Output: C: The set of materialized views.

Step 1: Construct the m × n Attribute Usage Matrix where m is the number of attributes and n is the number of queries.

Step 2: Construct the n × n Attribute Similarity Matrix from the Attribute Usage Matrix.

/* In step 3 the Graphs & the corresponding clusters are constructed */

Step 3: (Ai, Aj) Attribute Similarity Matrix, identify the attribute pair similarity values so that J (Ai, Aj) cut-off.

Store these values in a list L in descending order.

Store the number of elements in L into a variable count.

a) If count = 0 then go to step 5. /* The algorithm fails to draw any graph. Therefore, no materialized view can be constructed */

b) If count > 0 then Repeat until list L is empty

i) Pop the ith (1 I count) element from L. Store the value of the element into avariable x (0 x 1).

ii) Attribute pairs (Ai, Aj) Attribute Similarity Matrix

If J (Ai, Aj) = x, then Gi Gi Ai Aj /* Pair of attributes is inserted

in Gi, where Gi represents the ith graph for ith highest similarity value. */

iii) Ci Gi /*Ci represents the ith cluster for ith highest similarity value. */

iv) C C Ci /* Each cluster Ci is added to the set of clusters C */

/* In step 4 the clusters are validated and materialized views are formed*/

Step 4: Ci C, Calculate (Ci)avg by equation:

( C i ) a v g = i = 1 ( n 2 ) J ( A i ; A j ) ( n 2 ) where i # j

If ((Ci)avg < cut-off then C C Ci

/* C represents the set of materialized views where each cluster Ci represents a valid materialized view */

Step 5: End.