Number of columns influence performance?

6

When we model a database, can the number of columns interfere with performance?

Ex: Tabela1 possui 2 campos, 1 int pk e 1 nvarchar(50)
    Tabela2 possui 50 campos, 1 int pk e 49 nvarchar(50)

Select used for both tables, regardless of column size:

select Id,Nome from Tabela1
select Id,Nome from Tabela2
    
asked by Rod 27.10.2015 в 13:01
source

1 answer

8

Everything can interfere with performance, but here comes the question of whether or not you need it. It certainly influences, but very little and proportional. Actually proportional amortized, because some operations will not make any difference how many columns it has.

There are many more important reasons that will influence performance.

Do not worry about it. If you need many columns, put it. If there is no reason for them to exist, you do not have to create them. If I try to merge data into a column to have fewer columns, then I'd say it will make the performance even worse and it will generate a lot of confusion. Do not do this.

Even though you have many columns, read only the ones you need in that query . This minimizes impact.

Having too much data can indirectly influence performance because it can fill the cache faster and have access to disk more often. But note that the total data size is more important than the number of columns.

    
answered by 27.10.2015 / 13:10
source