76 karma · joined Jun 14, 2021 (5y ago) · 6 submissions
comment 5y ago · link · parent
This schema is also in Boyce-Codd normal form. It's normalized in every usual sense of the word. Trivially so, even. It's not a question of being "technically" correct. If you think the second schema is more normalized than the first one, you need to re-evaluate your mental model of what normalization means. That's all there is to it.
comment 5y ago · link · parent
>How do you mean? If id1 is unique on table A, and table B has a foreign key dependency on A.id, then yeah you still have id1 in twenty locations but it's normalized in that altering the referenced table once will alter the joined value in all twenty cases.
Ok, but that's not what normalization means.
If you have a table as described in the article that looks like:
foo | bar | baz
------------------
foo1 | bar1 | baz1
foo2 | bar2 | baz2
foo3 | bar3 | baz3
foo4 | bar1 | baz2
foo3 | bar1 | baz4
and then you say "ok, bar1 is now actually called id1", you now have a table
foo | bar | baz
------------------
foo1 | id1 | baz1
foo2 | bar2 | baz2
foo3 | bar3 | baz3
foo4 | id1 | baz2
foo3 | id1 | baz4
you haven't actually changed anything about the relationships in this data. You've just renamed one of your values. This is really a form of compression, not normalization.
Normalization is fundamentally about the constraints on data and how they are codified. If you took the author's schema and added a new column for the country where the ip address is located in (so the columns are now ip, helo, from, to, and country), then the table is no longer normalized because there is an implicit relationship between ip and country--if ip 1.2.3.4 is located in the USA, every row with 1.2.3.4 as the ip must have USA as the country. If you know the IP for a row, you know its country. This is what 3NF is about. Here you'd be able to represent invalid data by inserting a row with 1.2.3.4 and a non-US country, and you normalize this schema by adding a new table mapping IP to country.
But none of that is what's going on in the article. The author described several fields that have no relationship at all between them--IP is assumed to be completely independent of helo, from address, and to address. And the second schema they propose is in no way "normalizing" anything. The four new tables don't establish any relationship between any of the data.
>This might not be important in the spam-graylisting use case, and very narrowly it might be 3NF as originally written, but it certainly wouldn't be if there were any other data attached to each email address, such as a weighting value.
It's not "very narrowly" 3NF. It's pretty clear-cut! A lot of commenters here are referring to the second schema as the "normalized" one and to me that betrays a fundamental misunderstanding of what the term even means. And sure, if you had a different schema that wasn't normalized, then it wouldn't be normalized, but that's not what's in the article.
comment 5y ago · link · parent
comment 5y ago · link · parent
Of course the main point still stands, that the two schemas are exactly as normalized as each other.
Edit: rereading the original post, the author mentions that "they forged...the HELO"--so perhaps there was indeed no relationship between HELO and IP here. But again, I don't know anything about SMTP, so this could be wrong.
comment 5y ago · link · parent
Normalization does not mean "the same string can only appear once". Mapping the string "address1@foo.bar" to a new value "id1" has no effect on the relations in your table. Now instead of "address1@foo.bar" in 20 different locations, you have "id1" in 20 different locations. There's been no actual "deduplication", but that's again not the point. Creating the extra tables has no impact on the normalization of the data.
comment 5y ago · link · parent
In my BigCo job, your run-of-the-mill managers don't have any influence on this stuff. The high-level decisions are being made by executives who are at least four or five layers of reports away from the masses of ICs (eg the CEO is seven hops above me on my management chain), and whose entire job--as well as the entire job of everybody they come in contact with--consists of attending meetings. We experience the company and the workplace in vastly different ways, and articles & discussions like this are the result of that disconnect.