|
|
|
|
|
by subhajeet2107
1260 days ago
|
|
> Joins are cheap. Normalise earlier I am sure i have heard strong opinions like this but in practice joins are never cheap, tables with billions of rows crossed with millions of rows just to find a single row with data is not something i would call cheap, more often than not it is better to avoid joining large tables if you can live with duplicate data, also one trick i have found better is just to archive data in your tables which are not accessed frequently and reduce the size of tables keeping only the data which is needed |
|
DB guy with 25+ years experience. Summary: it depends.
> joins are never cheap
it depends. On table size, indexes/table size vs how expensive the alternative is. Always!
> tables with billions of rows crossed with millions of rows just to find a single row with data is not something i would call cheap
indexes
> more often than not it is better to avoid joining large tables if you can live with duplicate data
1E9 x 1E6 = 1E15 (at worst anyway). A join via an index will save you colossal amounts of IO (though as ever, it depends).
Problem here isn't this mostly clueless advice (discarding/archiving unnecessary data is the only good idea here, and it's not used as often as it should be). Problem is strong opinions put forth by someone who doesn't have the necessary experience, or understanding of what's going on under the hood. Denormalising is a useful tool that IME rarely gains you more than it loses you, but this 'advice' is just going to lead people down the wrong alley, and I'm tired of suchlike n00b advice strongly (and incorrectly and arrogantly) expressed on HN.
(edited to fix maths error)