Solved

How to speed up update table against views

Posted on 2006-06-13
6
286 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
  • 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Mysql vs Oracle 10 120
sql calculate reminders 11 56
MarkLogic 1 48
compre toata in where clue oracle 4 41
Read about achieving the basic levels of HRIS security in the workplace.
Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now