TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A terrible schema from a clueless programmer

33 pointsby ciprian_craciunover 3 years ago

9 comments

08-15over 3 years ago
I must be missing something, but the &quot;solution&quot; with the 3NF and five separate tables with their own indices seems artificial and like pointless overengineering. Isn&#x27;t this solved by a single index?<p>Or maybe a relational DB is already overengineering. Using a hash table (some libdbm lookalike) to map (ip,helo,from,to) to (time) solves the problem, too, and doesn&#x27;t have a low performance failure mode.<p>This doesn&#x27;t change the major point about everyone having been a newbie at point, though.
评论 #29140339 未加载
评论 #29147835 未加载
hancheover 3 years ago
The important bit comes at the end:<p>&gt; That&#x27;s right, <i>I</i> was that clueless newbie who came up with a completely ridiculous abuse of a SQL database that was slow, bloated, and obviously wrong at a glance to anyone who had a clue.<p>&gt; My point is: EVERYONE goes through this, particularly if operating in a vacuum with no mentorship, guidance, or reference points. Considering that we as an industry tend to chase off anyone who makes it to the age of 35, is it any surprise that we have a giant flock of people roaming around trying anything that&#x27;ll work?
wodenokotoover 3 years ago
I&#x27;m kinda shocked that relational databases work so poorly out the box, that you can&#x27;t even have a simple table with 4 or 5 values you care about, but have to split it out into 5 different tables and then create business rules about how to connect those into the original table.
评论 #29138653 未加载
评论 #29137692 未加载
评论 #29137601 未加载
评论 #29138102 未加载
dekhnover 3 years ago
I remember when I first started to do &quot;real work&quot; in mysql (instead of just tiny crud apps). i wanted to store a tree structure, and talked to the most skilled DBA in the room (who happened to be our group admin). Turns out, the way to do this in sql is to make parent pointers (not list of child pointers), exactly the opposite of how everybody else in the world does it. Later I learned that postgres has compound types and array types which work fine for trees.
xupybdover 3 years ago
I&#x27;ve been there too but wouldn&#x27;t using an int to store the IP make more sense than pushing it out to its own table? Just as fast and one less table.
评论 #29138597 未加载
throwaway984393over 3 years ago
I think I care less about whether the programmer is clueless, and more about the immediate effects of that cluelessness. If their clueless implementation is meeting the minimum requirements and goals that it was intended for, then it doesn&#x27;t matter if it&#x27;s terrible or not, it&#x27;s good enough. If it&#x27;s not meeting the minimum requirements, then I want them to do it in a way that does.<p>Another thing I think about more often is when my code will die. Everybody&#x27;s code gets replaced eventually. How difficult will it be for the next person to replace your code? What kind of impact are you having on future generations? If I write my code to be super efficient and &quot;fancy&quot;, will it be that much more difficult to replace in the future? Could I have written it in a different way that made it easier to deal with? I hope I make the right decisions. I don&#x27;t want somebody to be cursing me when I&#x27;m long gone.
Enderboiover 3 years ago
<i>looks at greylisting table schema</i><p><i>looks at Rachel&#x27;s blog post</i><p><i>looks at greylisting table schema again</i><p>Doh! :P
greypowerOzover 3 years ago
greylisting was a fun time. And yes i too have absolutely been that person :)
valyagolevover 3 years ago
isn&#x27;t this a reinvention of indices?