Altering precomputed result sets

Use the alter command to change the precompute result set’s policies or properties. The syntax is:

alter {precomputed result set | materialized view} 
		prs_name 
	{immediate | manual} refresh
	| enable | disable 
	| {enable | disable} use in optimization

See Reference Manual: Commands.

This example alters the author_prs precomputed result set from manual to immediate:

alter precomputed result set author_prs
immediate refresh

alter automatically refreshes the precomputed result set when you change from a manual to an immediate refresh, or from disable to enable. Altering a precomputed result set for disable use in optimization prevents the precomputed result set from participating in future query rewriting. However, any plans already cached using the precomputed result set are not recompiled.

Similar to other DDL commands, you cannot issue alter precomputed result set as part of a multistatement transaction (unless you set the ddl in tran option to true for the database). You must be the owner of the precomputed result set to issue alter precomputed result set

If the base table or view on which the precomputed result set is based is dropped or altered, the precomputed result set is automatically altered to disable. Adaptive Server sets the precomputed result sets to disable when you run bcp in or select into existing against any base table from which the precomputed result set is generated.

When you alter a precomputed result set to disable (with the alter precomputed result set command or with the alter table command on the base table), any plans already cached that use the precomputed result set are recompiled when the plan is next executed.