Solved

How to speed up update table against views

Posted on 2006-06-13
6
293 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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

624 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