Click here to Skip to main content
15,895,011 members
Home / Discussions / Database
   

Database

 
QuestionChange Data Capture is not capturing before value for the Images Pin
indian14327-Apr-16 11:17
indian14327-Apr-16 11:17 
AnswerRe: Change Data Capture is not capturing before value for the Images Pin
Eddy Vluggen29-Apr-16 6:44
professionalEddy Vluggen29-Apr-16 6:44 
QuestionEnable-Migrations, I don't get it - EF6 Pin
jkirkerx23-Apr-16 13:36
professionaljkirkerx23-Apr-16 13:36 
QuestionImproving Performance of Dynamic Sql Pin
indian14319-Apr-16 12:25
indian14319-Apr-16 12:25 
SuggestionRe: Improving Performance of Dynamic Sql Pin
CHill6020-Apr-16 2:50
mveCHill6020-Apr-16 2:50 
GeneralRe: Improving Performance of Dynamic Sql Pin
indian14326-Apr-16 7:55
indian14326-Apr-16 7:55 
AnswerRe: Improving Performance of Dynamic Sql Pin
Oscar Salgado9-Aug-16 12:44
Oscar Salgado9-Aug-16 12:44 
QuestionImproving Performance of my SP which is looping using While Pin
indian14318-Apr-16 12:54
indian14318-Apr-16 12:54 
Hi, I have written a stored Procedure which fills data in to a Flat table, but all it needs to do is to check if a particular row is there if not insert the record to avoid duplication of the values.
And I am making this check against the same table that I am inserting. I am not sure what went wrong after this check the SP Performance has drastically dropped from 4 minutes to 20 minutes. Can anybody please help me how to improve performance of the SP in these situations.

Here is the check that I am doing on the table, all those columns that I am checking against are must, I have check this to avoid duplicate data in the table.
IF (@ChangeSetId IS NOT NULL)
        BEGIN           
            IF NOT EXISTS (select top 1 * from TrackUpdatedColumnNamesFlatTable where 
            ChangeSetId=@ChangeSetId AND TransactionType=@TransactionType and TableName=@TableName
            AND ColumnName=@ColumnName and PrimaryKeyColumnName=@PrimaryKeyColumnName and 
            PrimaryKeyValue=@PrimaryKeyValue)
            begin           
                INSERT INTO TrackUpdatedColumnNamesFlatTable
                   (
                   ApplicationId
                    ,ApplicationComponentId
                    ,ApplicationName
                    ,ApplicationFriendlyName
                    ,SubApplicationName
                    ,SubApplicationFriendlyName
                    ,UserId
                    ,SamAccountName
                    ,FullName
                    ,DefaultDisplayValue                
                   ,ChangeSetId
                   ,TransactionType
                   ,TableName
                   ,ColumnName
                   ,ColumnNameForDisplayValue
                   ,FriendlyColumnName
                   ,ColumnValueBefore
                   ,ColumnDisplayValueBefore
                   ,ColumnValueAfter
                   ,ColumnDisplayValueAfter
                   ,PrimaryKeyColumnName
                   ,PrimaryKeyValue
                   ,ImageBefore
                   ,ImageAfter
                   ,ChangedBy              
                   ,ChangedDate
                   ,IsSoftDelete               
                   )
                select             
                   @ApplicationId,
                    @ApplicationComponentId,
                    @ApplicationName,
                    @ApplicationFriendlyName,
                    @SubApplicationName,
                    @SubApplicationFriendlyName,
                    @UserId,
                    @SamAccountName,
                    @FullName,
                    @DefaultDisplayValue,               
                   @ChangeSetId,
                   TransactionType,
                   TableName,
                   ColumnName,
                   @ColumnNameForDisplayValue,
                   @FriendlyColumnName,
                   ColumnValueBefore,
                   @ColumnDisplayValueBefore,
                   ColumnValueAfter,
                   @ColumnDisplayValueAfter,
                   PrimaryKeyColumnName,
                   PrimaryKeyValue,
                   ImageBefore,
                   ImageAfter,
                   @FullName,
                   @AuditDate,
                   IsSoftDelete
                from #TrackUpdatedColumnNamesFlatTable where ID=@MinId 
            end
        END

Unfortunately the SP is using the Dynamic Sql any thing to increase the Performance of the application helps a lot.
Any help a suggestion, a code snippet or a link anything helps me please. Thanks in advance.
Thanks,

Abdul Aleem

"There is already enough hatred in the world lets spread love, compassion and affection."


modified 18-Apr-16 20:32pm.

AnswerRe: Improving Performance of my SP which is looping using While Pin
Chris Quinn19-Apr-16 0:45
Chris Quinn19-Apr-16 0:45 
QuestionHow to sum consecutive in number of day Pin
hmanhha14-Apr-16 8:10
hmanhha14-Apr-16 8:10 
AnswerRe: How to sum consecutive in number of day Pin
Richard MacCutchan14-Apr-16 20:52
mveRichard MacCutchan14-Apr-16 20:52 
GeneralRe: How to sum consecutive in number of day Pin
hmanhha14-Apr-16 22:04
hmanhha14-Apr-16 22:04 
GeneralRe: How to sum consecutive in number of day Pin
Richard MacCutchan14-Apr-16 22:11
mveRichard MacCutchan14-Apr-16 22:11 
AnswerRe: How to sum consecutive in number of day Pin
John C Rayan15-Apr-16 4:47
professionalJohn C Rayan15-Apr-16 4:47 
QuestionReport is time out Pin
Member 1083678514-Apr-16 1:42
Member 1083678514-Apr-16 1:42 
AnswerRe: Report is time out Pin
Richard Deeming14-Apr-16 1:56
mveRichard Deeming14-Apr-16 1:56 
GeneralRe: Report is time out Pin
Member 1083678514-Apr-16 2:21
Member 1083678514-Apr-16 2:21 
GeneralRe: Report is time out Pin
Richard Deeming14-Apr-16 2:24
mveRichard Deeming14-Apr-16 2:24 
GeneralRe: Report is time out Pin
Member 1083678514-Apr-16 2:39
Member 1083678514-Apr-16 2:39 
GeneralRe: Report is time out Pin
Richard Deeming14-Apr-16 8:28
mveRichard Deeming14-Apr-16 8:28 
Questionhow to display record on screen Pin
Member 1245752113-Apr-16 17:08
Member 1245752113-Apr-16 17:08 
AnswerRe: how to display record on screen Pin
Richard MacCutchan13-Apr-16 20:51
mveRichard MacCutchan13-Apr-16 20:51 
QuestionTest AlwaysOn Availability Groups (mirroring) Pin
Bastien Vandamme11-Apr-16 22:15
Bastien Vandamme11-Apr-16 22:15 
AnswerRe: Test AlwaysOn Availability Groups (mirroring) Pin
Eddy Vluggen15-Apr-16 0:54
professionalEddy Vluggen15-Apr-16 0:54 
QuestionVS 2013 Get detailsview with SQL light Pin
BobbyStrain11-Apr-16 15:01
BobbyStrain11-Apr-16 15:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.