Split the table in two?

Asked

Viewed 362 times

1

I have a table with 25 columns (counting the FK) and two groups of users, one will access only 10 columns and the other will access almost all. Because I thought I had many columns in a single table (and I think object orientation too) I ended up dividing them into two, but I think it just increased the complexity.

So I’d like to know:

- 25 columns is a lot for a table?

- Thinking about goal orientation, are there many attributes to a class? (Large Class?)

- 6 FK is a high number?

- What would be ideal in a situation like this?

Columns:

codigo_projeto
codigo_interno
valor *
nota_fiscal *
data_entrega_relatorio
status
observacao1
observacao2
finalidade
tipo
setor
data_instalacao
data_ultima_avaliacao
data_conclusao
data_conclusao_laudo
concluido
idlocalizacao
idcultura
idalvo
idagrotoxico

A few more fields can be added.

  • Depends, depends on several factors. perincipalmente of your business.

  • 1

    Don’t divide tables randomly just by dividing, anyway. There are right ways and wrong ways to do this. With this amount of fields, there are likely to be some normalizations to be done. See this: http://answall.com/a/151394/132

  • 1

    Ah, and if you want better help, detail what your 25 fields are, one by one. Detail which are your 6 Fks and tell which are the exact 10 fields should be open to the first user. Without giving this information, the best you’ll get is a vague, generic, superficial response. With this information, it will be much easier to give you the answer you need.

  • I thought of a generic way to get a sense, but really, without detailing it gets difficult. I added the columns and seeing now, they are less columns and Fks than I thought, and it is also only the two asterisked columns that will not be visualized by one of the groups. Observing now it is evident that it is best not to separate. Thank you.

1 answer

7


  • 25 columns is a lot for a table?

No, it’s a misery (although most models are even smaller than that).

  • Thinking about goal orientation, are there many attributes to a class? (Large Class?)

Think about the need of your model, forget about this size thing. Object orientation is something else. If you don’t understand what it is, don’t even go for it. If you think it will help you, understand fully how it works before you do anything else, or go for the obvious and ululating.

  • 6 FK is a high number?

No, numbers don’t matter, what matters is whether you’re expressing what you need. Maybe it’s too much, but not because of the number, just because you might be doing what you don’t need.

  • What would be ideal in a situation like this?

You can’t tell without knowing the problem in depth.

  • I added the columns and they are less fields and Fks than I had thought, and they are only two fields (with asterisks) that will be unique to a group. Well, it is clear that the best is not to separate. It is very good to know about the numbers, this kind of thing has always left me in doubt. Thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.