Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 631893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:01:00+00:00 2026-05-13T20:01:00+00:00

The main problem is that in my sp there are different objects and logic

  • 0

The main problem is that in my sp there are different objects and logic that may cause lack of performance.

The things that I see on my SP and the tables that are in use in the SP
1- Temp tables such as shown below; (2 Temp Tables)

CREATE TABLE #TEMP_TABLE(
AB INT NOT NULL,
AC INT NOT NULL,
AD INT NOT NULL,
AF INT NULL,
AG INT NULL,
REFERENCE_NUMBER INT NULL
)
CREATE NONCLUSTERED INDEX IX_1 ON #TEMP_TABLE (AB , AC, AD)

2- Insert process to the create temp table as TEMP1 in the SP

3- DROP TABLE #TEMP_TABLE
DROP TABLE #TEMP_TABLE2
in the end of the SP

4- There are two tables used to join themselves, but not all the fields that are used “on” case of JOIN operator. For instance; there are clustered index fields declared on the first table, plus date column which is not in the clustered index groups of the first table..

For short; Clustered and non clustered indexes are important ok, but in which order should i declare them. What i need from which index type, tell me the order of cretation of indexes for further use of JOIN process etc.

5- Should I use table variable instead of temp table. Ok it will be better but there are lots of question mark that does not let me to use the table variables..

*An INSERT into a table variable will not take advantage of parallelism.
ref->

6- I heard about logical reads. Should i really take care about these numbers.
The details of an example data’s results are shown below (*)

7- The execution plan…

Execution Plan

*OUTPUT:

Table ‘CHANNEL’. Scan count 0, logical
reads 2, physical reads 0, read-ahead
reads 0, lob logical reads 0, lob
physical reads 0, lob read-ahead reads
0. Table ‘XYZ_DATE’. Scan count 1, logical reads 2, physical reads 0,
read-ahead reads 0, lob logical reads
0, lob physical reads 0, lob
read-ahead reads 0. Table
‘XYZ01’. Scan count 3171,
logical reads 13135, physical reads
153, read-ahead reads 0, lob logical
reads 0, lob physical reads 0, lob
read-ahead reads 0. Table
‘XYZ02’. Scan count
5, logical reads 51256, physical reads
0, read-ahead reads 0, lob logical
reads 0, lob physical reads 0, lob
read-ahead reads 0. Table
‘#TEMP_TABLE_________________________________________________________________________________________________________000000000840’. Scan count 0, logical reads 97,
physical reads 0, read-ahead reads 0,
lob logical reads 0, lob physical
reads 0, lob read-ahead reads 0. Table
‘Worktable’. Scan count 0, logical
reads 0, physical reads 0, read-ahead
reads 0, lob logical reads 0, lob
physical reads 0, lob read-ahead reads
0.

(32 row(s) affected) Table
‘#TEMP_TABLE2________________________________________________________________________________________________________000000000841′. Scan count 0, logical reads 64,
physical reads 0, read-ahead reads 0,
lob logical reads 0, lob physical
reads 0, lob read-ahead reads 0. Table
”XYZ03’. Scan count 0,
logical reads 107, physical reads 0,
read-ahead reads 0, lob logical reads
0, lob physical reads 0, lob
read-ahead reads 0. Table ”XYZ04”.
Scan count 32, logical reads 129,
physical reads 0, read-ahead reads 0,
lob logical reads 0, lob physical
reads 0, lob read-ahead reads 0. Table
‘#TEMP_TABLE_________________________________________________________________________________________________________000000000840’. Scan count 1, logical reads 1,
physical reads 0, read-ahead reads 0,
lob logical reads 0, lob physical
reads 0, lob read-ahead reads 0.

(21 row(s) affected)

(21 row(s) affected) Table
‘XYZ05’. Scan count 0,
logical reads 87, physical reads 0,
read-ahead reads 0, lob logical reads
0, lob physical reads 0, lob
read-ahead reads 0. Table
‘XYZ01A’. Scan count 21, logical
reads 147, physical reads 0,
read-ahead reads 0, lob logical reads
0, lob physical reads 0, lob
read-ahead reads 0. Table ‘XYZ04’.
Scan count 0, logical reads 84,
physical reads 0, read-ahead reads 0,
lob logical reads 0, lob physical
reads 0, lob read-ahead reads 0. Table
‘#TEMP_TABLE2________________________________________________________________________________________________________000000000841’. Scan count 1, logical reads 1,
physical reads 0, read-ahead reads 0,
lob logical reads 0, lob physical
reads 0, lob read-ahead reads 0.

(*)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:01:01+00:00Added an answer on May 13, 2026 at 8:01 pm

    I did put some indexes then scans are doing seek..
    now it is better.

    still doing performance tests:
    follow here-> Testing Stored Procedure performance

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 368k
  • Answers 368k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can use SET NOCOUNT ON to suppress the rowcounts… May 14, 2026 at 6:04 pm
  • Editorial Team
    Editorial Team added an answer If you're on .NET 3.5 or newer, you can do… May 14, 2026 at 6:04 pm
  • Editorial Team
    Editorial Team added an answer Use the RegionInfo.ISOCurrencySymbol property. For example: var ri = new… May 14, 2026 at 6:04 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.