Why should I separately use used / unused columns in a table?

As already mentioned, I have to separate columns that are often used from columns that are not. Why?

Is this because a table with fewer columns is better for cache? Is there any optimization for caching all columns, not for selection? Is this often readable for tables? Should I split the frequency recording columns into my own table?

+3
source share
4 answers

When you update a row, many databases will make a copy of the entire row. Depending on how long copies of the row are stored (which depends on many factors), you may get more garbage in the database than if you split the row into two tables. This garbage will make the database larger and therefore can make queries slower.

If you want to prematurely optimize denormalization (which you would need to do in order to get rows that could benefit from a split), you should consider anyway.

+1
source

, , ( , , , , .). , , , . , " " .

+2

RL ( 1 ) .

"", :

  • , , , , .
+1

, , . , . , , , , , . , , , .

I don’t know exactly how MySQL performs all its searches at the most basic level, but I assume that if you use column names when choosing, rather than *, then this problem will be minimized.

Again, I don’t know the details of how all this is encoded, but I don’t think this should be a problem if you do not select columns that you do not need.

0
source

Source: https://habr.com/ru/post/1751818/


All Articles