Posted on 14 Comments

Do you have a fork stuck in your head?

This is actually a MySQL-related post, but I like odd analogies – stuff that makes you laugh tends to be remembered better!

So to get back to the fork… it’s stuck in your head and you have a serious headache.
You go to the doctor. Would you like the doctor to
A) prescribe something for the headache, or
B) identify that the fork might be causing the headache, and suggest that it be removed?
There may be other factors causing the headache, but leaving the fork there is probably a bad idea anyway, right?

When someone asks me questions like “what’s the maximum number of columns MySQL can have in a table”, a little alarmbell goes off in my head (better than a fork, eh!), and I try to explore the “why” – much to some people’s annoyance… they just want “the answer”. But I do this because it’s one of those anti-patterns, indicative of other issues. There are indeed valid reasons to require lots of columns, but not many.

I have standards, and I apply them on Freenode #mysql IRC as well as with Open Query clients. I don’t want to just help you “fix” your headache while leaving a fork in your bleeding head.
Instead, I’d like to make sure there’s no fork, first. Once you’re aware of the issues in the anti-pattern, you can make an assessment (with or without assistance) whether the problem you were trying to address is actually the real problem, or whether you want to deal with any underlying issues.
Am I an annoying doctor? 😉

Posted on 14 Comments

14 thoughts on “Do you have a fork stuck in your head?

  1. I agree ++

  2. Funny that people get annoyed. I think it’s because on some level they percieve you as thinking “you don’t know what you’re doing, so I’ll sort it for you”. I tend to ask the same questions as described (when I have good subject knowledge), and more often than not, people _don’t_ know what they’re talking about. The trick is to asking in a non-threatening way. I usually find giving the answer they want _first_, then probing a bit more works…

  3. So how many columns? Seriously?

  4. Mark, that approach just scares me – at least for the MySQL realm.
    Of course if you have the person there, it’s possibly doable… but you really don’t want them to run of and continue happily on their hazardous trail!

  5. Seriously, it depends somewhat on the MySQL Server and storage engine used.
    For any recent version you can get at least up to around a 1000.

    It’s well above what “normal” schema designs would trip over, thus anything getting even close to the limit needs to seriously consider whether their design is appropriate. Start worrying and re-assessing before 100, not 1000 😉

  6. It’s also limited by some FRM file format stuff. There’s a test that expects too many columns error when adding column 65 – so it’s not a constant. Fixed in Drizzle though 🙂

  7. Yeah – I agree it’s not “optimal”. Mainly for when the person is “in front of you”. If it was an email enquiry (or even phone), then yeah – probe away !!! The trick is explaining why they are wrong, without offending them… (assuming they are in fact, wrong).

  8. Just to be clear: We don’t see MySQL forks as a problem 🙂

  9. So we can have now more columns in Drizzle ? Not a lousy 4000 but 10000 and even 65536 ?

    Hurra!

  10. Indeed – we were talking about real utensil forks today, not the proverbial code-tree forks 😉

  11. Unfortunatly for systems people ITIL makes this worse, it preaches that workarounds that your helpdesk people can do are far more important then actually reporting a bug and getting it fixed. According to it the workaround pretty much is the fix.

    Fortunatly we don’t take it to that level at the office, although we do a thoughraly forked head (what, NFS isn’t cache coherent?)

  12. The (Drizzle) server will limit you to 4096 now (although that should be able to be trivially lifted).

    Previously the limit could be as low as 64 as imposed by the server.

    You (of course) may hit engine limits too

  13. Are you sure that that’s actually what ITIL says, or is this just some dumb implementation of it?

  14. Probably a bit of both.

Comments are closed.