Wednesday, March 28, 2012

Precomputed tables

Dear Friends,

Suppose a database (SQL SEVER 2003) is consists of 500 Tables & 1000 Views.

As I understand from the theory, that Views are nothing but the queries stored in the databse. Whenever a view is referenced than it starts fetching data from tha database. Thus , it will force the processor to do calculations.

To reduce the processor burden and to ge the fast response: instead of keeping 1000 Views- I wish to keep precomputed tables in the databse.

Would this be fair practice?

Your suggestions & guidence required. Further Discussions are welcome.

Thank You.

SuryaPrakash

*****************************************
* This message was posted via http://www.sqlmonster.com
*
* Report spam or abuse by clicking the following URL:
* http://www.sqlmonster.com/Uwe/Abuse...922abd573f7447e
*****************************************SuryaPrakash Patel via SQLMonster.com (forum@.SQLMonster.com) writes:
> As I understand from the theory, that Views are nothing but the queries
> stored in the databse. Whenever a view is referenced than it starts
> fetching data from tha database. Thus , it will force the processor to
> do calculations.

Not necessarily. You can index views, in which case SQL Server will
materialize them. However, not all views are indexeable. See the topic
on CREATE INDEX in Books Online for the many restrictions.

> To reduce the processor burden and to ge the fast response: instead of
> keeping 1000 Views- I wish to keep precomputed tables in the databse.
> Would this be fair practice?

Depends. If there is heavy updating going on, keeping the views (pre-
computed tables in sync) can take too much load. But if updates only
comes once a day, and in the middle of the night, and in the daytime
there are only queries, pre-computing can be a very good idea.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.aspsql

No comments:

Post a Comment