Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check records count in a view (T_SQL and Enterprise manager)

Status
Not open for further replies.

lyudmila

Programmer
Oct 18, 2002
54
US
How i can check records count in a view (T_SQL and Enterprise manager)
 
SELECT Count(*) FROM ViewName

--Angel [rainbow]
-----------------------------------
Every time I lose my mind, I wonder
if it's really worth finding.
 
Takes only few seconds to create a view but it takes forever to read from view! Is it common problem or it's a problem on iur server, I did not use view before. Please respond, I need to figure it out! have no time!
Thank you!
 
Ah, I suspected the answer wasn't that easy. Can you provide the code for the view? How many tables are involved in the view? Are JOIN columns indexed?

A view is nothing more than a pre-compiled SELECT statement. I suggest taking the SELECT statement of the view and run it in Query Analyzer with Show Execution Plan turned on. When it finally finishes, review the execution plan. Look for table scans and clustered index scans. If you can create indexes to eliminate the scans, then you'll probably improve performance.

--Angel [rainbow]
-----------------------------------
Every time I lose my mind, I wonder
if it's really worth finding.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top