Table scan and Index scan both are same or not?

  • Hai,

    this is anitha,any difference between indexscan and tablescan.

    which cases it will be useful for us?

  • Scanning clustered index on the table consumes the same resources as performing full scan.

    However if index is nonclustered, scanning it will read all the index pages, but these are different to table data pages.

    Refer to 'SQL Server Optimization' article (http://msdn.microsoft.com/en-us/library/aa964133.aspx ) for more info on indexes, table scans etc.

    Cheers, Max

    Check-out free open-source utility Sql Server Replication Explorer[/url]
  • thank you max

  • Generally, an index scan is faster, because it only contains columns which are indexed (unless it's a clustered index).

    Keep in mind that a table scan is not always bad. Especially if it's a small table, the optimizer will prefer a tablescan depending on your where clause.

    Wilfred
    The best things in life are the simple things

  • In SQL Server 2005 nonclustered index can contain 'included' columns which are not part of index key, but are added to the leaf level. Index scan would also read these 'included' columns.

    Article from MSDN: Index with Included Columns (http://msdn.microsoft.com/en-us/library/ms190806.aspx)

    Cheers, Max

    Check-out free open-source utility Sql Server Replication Explorer[/url]

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply