Re: Stored Procedure: Insert VS Update
- From: "Russell Fields" <russellfields@xxxxxxxxxx>
- Date: Wed, 29 Jul 2009 16:22:58 -0400
Then I would go with the single join in the expectation that it is the best answer.
If performance problems surface later, then check the execution plans, analyze why, and choose a course that addresses the particular problems that you find.
All the best,
RLF
"eighthman11" <rdshultz@xxxxxxxxxx> wrote in message news:90a43fa5-fc20-49ce-988c-fb12ab773efb@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Jul 29, 2:29 pm, "Russell Fields" <russellfie...@xxxxxxxxxx> wrote:
Ray,
The answer is: "It depends".
Assuming that the tables that you need to join are all well-indexed for the
joins you need to include in this worktable, then doing it once is more
efficient than making several passes doing updates.
I have seen times where am insert followed by a couple of updates ran more
quickly than the full join, but that was because of design and indexing
problems, or because early versions of SQL Server did not optmize as well at
the more current versions. (But you are not on a pre-SQL Server 2000
version are you?)
FWIW,
RLF
"eighthman11" <rdshu...@xxxxxxxxxx> wrote in message
news:0e3db150-70d6-49ac-8fb8-6eb2b4aef4ce@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hello everyone,
> Against my better judgement I have been thrust into the duty of
> creating Crystal reports for my company. I have discovered rather
> quickly that I also need to become familar with SQL (creating views
> and stored procedures).
> Quick question.
> I have a stored procedure were I created a workfile. Several thousand
> records get inserted in this work file. Is it normally quicker to
> join all the tables I need for the insert or is it faster to get all
> the base records inserted into the workfile then do one or more
> updates to the workfile using the other tables that I didn't join.
> Any help appreciated
> Thanks Ray- Hide quoted text -
- Show quoted text -
Thanks for the reply:
All the tables are indexed very efficiently and we are on SQL Server
2008
.
- References:
- Stored Procedure: Insert VS Update
- From: eighthman11
- Re: Stored Procedure: Insert VS Update
- From: Russell Fields
- Re: Stored Procedure: Insert VS Update
- From: eighthman11
- Stored Procedure: Insert VS Update
- Prev by Date: Re: Stored Procedure: Insert VS Update
- Next by Date: Evaluating OLAP products
- Previous by thread: Re: Stored Procedure: Insert VS Update
- Next by thread: Evaluating OLAP products
- Index(es):
Relevant Pages
|