MySQL / Rails Performance: One table, many rows vs. many tables, less rows? -


In my train app, I have several models with properties (attachments, pictures, logos, etc.). I am using attachment_fu and so far I have 3 different tables to keep information in MySQL DB.

I am thinking that if I use STI and put all information in just 1 table, using a type of pillar and separate, inherited classes make it more dry and retaining It will be easy, because all the shares have many characteristics and features.

But what's faster? Many tables and just one table with few lines or few lines per line? Or is there no difference? I have to deal with a lot of information and many queries per second.

Thank you for your opinion!

Many tables and lower rows are probably faster.

It is not because you should do this, however: Your database should model your problem domain. A table is a bad model of many unit types. So you will eliminate many of that script and many more codes, represents the unit that represents the type of entity that is currently related to you.

Regular, accepted, clean database and front-end client code will not work due to one of your tables, that-everything-and-nothing-but-all.

It is slower, more fragile, AP will make all your code multiply on you, and makes a bad model.

If all things have the same properties as and the same (or possibly Liskov substitutable) semantic meaning in your problem domain.

Otherwise, do not try to do this either.

Or, if you do, then ask why this is better than a large map / hash table / associative array to catch all the units in your app (and many more Most of them, duplicated, cut and paste, and from old time, to understand the switch cases or RTTI the true type of each unit).


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -