SQL Server Performance

Does the number of columns and size of each column affect query execution time

Discussion in 'SQL Server 2005 T-SQL Performance Tuning' started by KT2009, Jan 21, 2009.

  1. KT2009 New Member

    Hello,
    Let's say one table has columns a, b and c and another has the same columns a, b, c plus some other large size columns d, e, f, and g.
    They both have the same number of records. Would a query to return rows where a=x and b=y be slower on the table with more columns?
    Thanks,
    KT
  2. ndinakar Member

    Depends on what indexes you have, size of data in the tables, and what columns you are pulling out.
  3. FrankKalis Moderator

    The wider a row is, the less rows fit on a single page which means that more pages have to be allocated for a wider table compared to a narrow table. SQL Server therefore has to touch more pages to fulfill a request on a wider table. That is SQL Server has to do more work for the same query. How this however affects performance depends on what Dinakar already mentioned.
  4. satya Moderator

    Just to addup if the memory is available for SQL then the performance will not be affected, if your query can select the rows using only indexes then the row size is less important (unless you are returning a very large number of rows where the IO of returning the actual result is significant.

Share This Page