Earlier quoted context omitted.
The one that always got us is much more mundane. Deleting a row requiring an index in every table with a FK to avoid tables scans. Near as I can tell, we assume there is some bit of magic built into the foreign key concept that handles this for us, but that is not the case.
Foreign keys are naturally referencing primary keys, which have their own (unique) indexes by default. And there's some extra magic with CASCADE. But it seems like I am missing your point: care to expand on it so I can learn about the gotcha as well? What are you attempting to do, and what's making the performance slow?
A terrible schema from a clueless programmer
311–320 of 493 posts
Re: A terrible schema from a clueless programmer
#312Earlier quoted context omitted.
In this blog post, senior engineer Rachel talks nonsense about normalization and promotes a bafflingly complicated solution as superior to a simple one, without identifying the actual fix, which appears to have happened accidentally. In other words, with enough empathy and patience, a clueless rookie can grow into a clueless senior engineer! Rachel usually makes more sense than that. That's why people are nitpicking…
Hah, pretty accurate and kinda funny, but could be nicer. I still make mistakes.
And in that context, everything makes sense.
Re: A terrible schema from a clueless programmer
#313Still not sure why adding an index didn't work instead of breaking out into multiple tables indexed by IDs.
Besides, this use case screams for "just store the hashes and call it a day".
Re: A terrible schema from a clueless programmer
#314Sure, I'll try and study to keep myself on my feet, but there is soo much to learn that I'd rather focus on the technologies needed right _now_ to get things done
Way more often than not "thing A has to be done with tech B" and the expectation of getting it done without multiple foot guns in gone
Re: A terrible schema from a clueless programmer
#315Earlier quoted context omitted.
> Clearly it worked. No it didn't. Someone else put an index on the main table and that worked.
The article declared that it was running in production and satisfying the requirement. Do you have a different definition of working? I say that to clarify what I was attempting to communicate by "it worked". I think you're remarking about the relationship between normalized tables and indexes. That relationship does exist in some databases. Please say more if I'm missing your point.
Re: A terrible schema from a clueless programmer
#316Earlier quoted context omitted.
How often are you looking at the full contents of a table vs. looking at the results of a query that you could throw an INET_NTOA onto?
Many. You also expect me to remember how to spell INET_NTOA and on what fields to use it on. What if I wanted do a quick "SELECT * FROM"? I barely know how to spell English words what makes you think I'm going to remember how to spell INET_NTOA.
Re: A terrible schema from a clueless programmer
#317People in the comments are getting (rightfully) outraged about the poor understanding of indexing, but I'm a little surprised that everyone here doesn't seem to understand normalization either. The original schema is perfectly normalized and is already in 3NF: none of the columns shown has a dependence on any of the other columns outside of the primary key (in other words, if you knew eg the values of the ip, helo, a…
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.
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.
Re: A terrible schema from a clueless programmer
#318Re: A terrible schema from a clueless programmer
#319Earlier quoted context omitted.
MySQL, at least as far back as 2000, had indexes. http://web.archive.org/web/20020610031610/http://www.mysql.c...
I wouldn't bet on these indexes optimizing anything back then. MySQL was legendary that while implementing the necessary standards (to some degree) it was neither reliable nor efficient.
Re: A terrible schema from a clueless programmer
#320Earlier quoted context omitted.
I feel like that phrase has been there forever, and I'm exactly 35. Will this happen more often as I grow older? Ugh. Feels weird. Maybe also a bit depressing.
It was weird seeing all the spongebob squarepants memes take over the internet when I was too old to ever grow up with that. I turned 28 in 1999 when that first aired. That was my "holy shit I'm so old" moment when that finally trickled up into my awareness as someone nearly turning 40 or so.