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

Related Questions

I have a problem in integrating PHP and JQuery: My main file is MyFile.html
The main user-case is: Create the 2D floor plan See the 3D view of
I was told that these types, that are visible in there own unique translation
I developed WPF / XAML applications that invoke objects (functions or Web services) which
I'm trying to merge two main menus together, but am having problems getting the
The main web application of my company is crying out for a nifty set
My main JavaScript framework is jQuery , so I would like my unit test
function main() { Hello(); } function Hello() { // How do you find out
Why main must be declared as if it has external linkage? Why it should
My main browsers (FF and Chrome) are both configured for a 12 pixel font.

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.