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 6826805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:11:29+00:00 2026-05-26T22:11:29+00:00

SELECT SUM(AMT) FROM TB_TMP_TR GROUP BY ACCNO SELECT SUM(AMT) FROM TB_TMP_TR2 GROUP BY ACCNO

  • 0
SELECT SUM(AMT) FROM TB_TMP_TR GROUP BY ACCNO
SELECT SUM(AMT) FROM TB_TMP_TR2 GROUP BY ACCNO

The only different thing is TB_TMP_TR has ACC as clustered index and TB_TMP_TR2 has ACC as non-clustered index.

Execution plan show that the 1st is take 65% and 2nd take 35% (batch relative)

but with

SELECT * FROM TB_TMP_TR WHERE ACCNO = @acc
SELECT * FROM TB_TMP_TR2 WHERE ACCNO = @acc

the 1st is faster

I’m wondering why ?

  • 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-26T22:11:30+00:00Added an answer on May 26, 2026 at 10:11 pm

    A covering non-clustered index will likely be narrower than the clustered index, since the clustered index must include all columns. Being narrower it means it has fewer pages, which means fewer reads (both physical and logical). Hence, it will be faster. Covering being the key word.

    Please run the two queries with

    SET STATISTICS TIME ON;
    SET STATISTICS IO ON;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So here is the original query SELECT SUM(PickQty), SUM(ReqQty), AssignmentID, StopID FROM PickRequest GROUP
select tt.threshold_id from (select sum(amount) over (partition by tt.threshold_type order by tt.threshold_type ) amt
select SUM (Bill) from ProductSaleReport group by PCI having MONTH(Date) between 1 and 3
select sum(value) as 'Value',max(value) from table_name where sum(value)=max(sum(value)) group by id_name; The error is:
I have this query: SELECT (SUM(tblTransaction.AmountPaid) - SUM(tblTransaction.AmountCharged)) AS TenantBalance, tblTransaction.TenantID FROM tblTransaction GROUP
I have a query as follows select * from ( select id,sum(amt) amt from
I have this query select SUM(Qty) as Qty from WorkTbl group by Status having
Query: SELECT SUM(ProductCost) FROM `tblBasket` GROUP BY ProductCode HAVING BasketSessionID = '3429782d79c68834ea698bb4116eef5e' Showing Error
SELECT sum(TotalHoursM) + (TotalHoursT) + (TotalHoursW) + (TotalHoursTH) + (TotalHoursF) AS TOTAL FROM LeaveRequest
SELECT SUM(a.Clicks) AS Clicks, SUM(b.NoOfUsers) Users, c.WEEK_NUM, b2.ALL_TASKS FROM (SELECT SUM(CLICK_CNT) AS Clicks, TO_CHAR(RQST_DT,'YYYY-MM-DD')

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.