Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to speed up update table against views

Posted on 2006-06-13
6
Medium Priority
?
295 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
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 

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 1000 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

705 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