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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:39:49+00:00 2026-05-16T05:39:49+00:00

If I have two table of data. One has a clustered index CINDEX, the

  • 0

If I have two table of data. One has a clustered index CINDEX, the other is a heap HEAP.

Both also have a non-clustered index on the same column – SEARCHCOL

Assume my clustered index columns are the same size as a rowid and therefore the depth of both of the non-clustered index is the same.

Which would take fewer I/O’s to fetch a table row…

a) SELECT * FROM CINDEX WHERE SEARCHCOL = :1

b) SELECT * FROM HEAP WHERE SEARCHCOL = :1

Choose a or b
Explain why
state any assumptions

  • 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-16T05:39:49+00:00Added an answer on May 16, 2026 at 5:39 am

    If the Searchcol has enough selectivity then the plan should do the expected seek into non-clustered index (identical between the two) and then lookup the clustered index or the heap in order to get all the columns as to satisfy the * projection. This later lookup will be faster in a heap (direct search by page:slot) compared to a BTree seek (has to hit 1-2 non leaf pages to land on the leaf page containing the row) if the heap row was not moved. If the heap row was moved, then the lookup has to chase the forwarding pointer on a new page, meaning a new logical read IO, and so on until it find the place (if it mover multiple times). So in general a heap would save 1-2 logical read IOs (the non-leaf part of the seek in the lookup).

    If the SEARCHCOL is not selective enough and the query hits the Tipping Point then all bets are off as one plan would to a clustered index scan in key order, while the other would to a heap scan in allocation order (they would end up roughly the same IO).

    But I have to warn that this kind of minutia measurement (1-2 page IOs) are not healthy when making a decision about heap vs. BTree. My take is always choose BTree unless there are explicit reasons not to. Explicit reasons would usually be INSERT performance (this is where HEAPs run circles around BTrees) and that implies ETL data load scenarios where the data is loaded into a heap for fast upload performance and then the heap is turned into a clustered index and added with a switch operaiton into the big fact table.

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

Sidebar

Related Questions

i have two data tables with the same structure the first one has one
I have two processes that work with data in the same table. One process
I have two tables, one has about 1500 records and the other has about
I have one database that has two tables. One table (Table A) has 3
I have two tables, one table has a list of videos, one has a
So, in a Workbook, I have two worksheets: One has a table full of
I have two tables, one has primary key other has it as a foreign
I have two tables. Table1 is our main table of data and Table2 has
I have two tables, one table has some information in each row along with
I have two SQL Server tables. One table has four nvarchar(50) nullable columns and

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.