Solved

How to speed up update table against views

Posted on 2006-06-13
6
291 Views
Last Modified: 2008-02-01
Hi experts,

I have a table, table_1, which contained half million records. I am updating it with more than 10 views once at a time. And it takes me forever. I didn't create any index for those views. I do created a cluster index and copule index for the table. One of the updating scripts like the following:

/****/
UPDATE table_1
SET table.product = 'Book'
FROM  table_1 ,vw_2005  
WHERE (table_1.ACCOUNT_ID = vw_2005.ACCOUNT_ID)
       AND (table_1.[YEAR] = 2005)
       AND (table_1.product IS NULL)
 

My question is
A. how can I speed up the update process?

B. Should I add those options to those views?
"SET NUMERIC_ROUNDABORT OFF
GO
SET ANSI_PADDING,ANSI_WARNINGS,CONCAT_NULL_YIELDS_NULL,ARITHABORT,QUOTED_IDENTIFIER,ANSI_NULLS ON
GO"

C.  should I add the statment "WITH   SCHEMABINDING " to the create view line?  
Thanks,  
0
Comment
Question by:LIULIHUA
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 3

Expert Comment

by:hardikbeit
ID: 16900534
U can also add
SET NOCOUNT ON in the beginning and SET NOCOUNT OFF at last
0
 

Author Comment

by:LIULIHUA
ID: 16901849
Hi hardikbeit,

Do you mean add
"SET NUMERIC_ROUNDABORT OFF
GO
SET ANSI_PADDING,ANSI_WARNINGS,CONCAT_NULL_YIELDS_NULL,ARITHABORT,QUOTED_IDENTIFIER,ANSI_NULLS ON
GO"
and also add "SET NOCOUNT ON in the beginning and SET NOCOUNT OFF at last" ?

0
 
LVL 3

Expert Comment

by:hardikbeit
ID: 16908779
Hi LIULIHUA,
that's right.

As per my knowledge without this command the SQL Query Analyzer gives total no of records updated. There is no need to see howmany rows updated each times, it decrease performance due to switching between sql query processor and IO.
0
Get Database Help Now w/ Support & Database Audit

Keeping your database environment tuned, optimized and high-performance is key to achieving business goals. If your database goes down, so does your business. Percona experts have a long history of helping enterprises ensure their databases are running smoothly.

 

Author Comment

by:LIULIHUA
ID: 16912088
Hi hardikbeit ,

if I don't want to set up index for the view then the only thing I need to set up is "SET NOCOUNT ON in the beginning and SET NOCOUNT OFF at last", am i right? because set up an indexed view are sort of complecated, what do you think?

0
 
LVL 3

Accepted Solution

by:
hardikbeit earned 250 total points
ID: 16917677
Hi Liulihua,
Yes you are right.

Index View is really a good option to improve your performance.

If you want to know how to create and use, check this link:
http://www.sqlteam.com/item.asp?ItemID=1015

you can improve performance with View Indexes, if applications that do any of the following may benefit as well:
-Joins and aggregations of big tables
-Repeated patterns of queries
-Repeated aggregations on the same or overlapping sets of columns
-Repeated joins of the same tables on the same keys
0
 

Author Comment

by:LIULIHUA
ID: 16919732
Thank you hardikbeit, this is very benefit for my project.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question