0

I have 60 columns in a table.

1). I want to add one more column to that table. Will there be any impact on performance?

2). How many columns can I add?

3). any idea for the avoid recursion. [I have no idea here - annakata]

Cade Roux
  • 88,164
  • 40
  • 182
  • 265
  • I say chap : fork in the right hand and knife in the left. Good day sir. – Learning Feb 18 '09 at 08:51
  • I think the question is legit but we need a lot more info, such as the structure of the table and data in it. Also I think you are using the term recursion in the wrong context. What do you mean by that? – Craig Feb 18 '09 at 11:00

3 Answers3

3

Yes, but one more column is less of a problem than the fact that you already have 60.

I bet most of them are nullable?

With very wide tables (many columns) it becomes harder to write maintainable SQL. You are forced to deal with lots of exceptions due to the NULLS.

See also this post which asks how many fields is too many?

Community
  • 1
  • 1
Ed Guiness
  • 34,602
  • 16
  • 110
  • 145
0

Will there be any impact on performance?

If you are adding a "Notes" type TEXT column, or a Blob storing the Image of a User, and most/many of your queries are

SELECT * FROM MyTable 

then you will definitely be creating a performance issue.

If you always explicitly only name the columns your query needs, like:

SELECT Col1, ColX, ColN 
FROM MyTable

then adding a new column will have little to no impact on performance - but wider rows mean fewer records per data page, so there is SOME impact, and if you are adding an Index to the new column then that index has to be maintained too - but if your application needs it then that is a necessary "cost".

We have plenty of tables with > 60 columns. However, I would like to think that that is By Design, rather than because the table has just grown willy-nilly.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Kristen
  • 4,227
  • 2
  • 29
  • 36
-2

If I were you I would be less concerned with the fact that you have to add one more column, and more concerned with deciding whether 60 columns is appropriate.

MrEdmundo
  • 5,105
  • 13
  • 46
  • 58
  • Number of columns has little bearing on normalization - it would be quite easy to have 60 independent variables that are unique for a given row. I'd wait until we see what's in those columns before passing judgment. – paxdiablo Feb 18 '09 at 09:39
  • Fair point. I guess I was making an assumption based on how poorly written his question was. – MrEdmundo Feb 18 '09 at 10:54
  • I strongly disagree - it can be valid, but a large number of columns is definitely a DB smell. It's unlikely even a 60 field object can't be normalised to child tables based on read/write frequency. – annakata Feb 18 '09 at 10:58
  • This is NOT an answer for Lalchand Saini's question. It lacks info, but Lalchand might have a specific reason for asking this question. – dance2die Feb 21 '09 at 05:45