in reply to Re: Perl or Mysql to store multiple choices?
in thread Perl or Mysql to store multiple choices?

Yes, that's exactly what I'm talking about. And what I'm thinking.

When a user selects options 1,4,7,9, and 15 on Monday, either:
a) store it as 5 separate insertions of update_id - option pairs
b) first join them into a delimited string and do one insert

Then on retrieval, either:
a) select all rows with Monday's update ID (which means a while loop)
b) select a single row and split the retrieved string

I expect the first reaction to be "let the DB do its work; it's undoubtedly smarter and faster", but I suspect that the counter-intutitive ins in fact true: that the extra DBI layer, with its preparation and the retrieval loop, is going in fact ot be slower than a pure join or split, especially when it gets more complicate with multiple questions to store and therefore multiple queries to do.




Forget that fear of gravity,
Get a little savagery in your life.
  • Comment on Re^2: Perl or Mysql to store multiple choices?

Replies are listed 'Best First'.
Re^3: Perl or Mysql to store multiple choices?
by roboticus (Chancellor) on Mar 30, 2007 at 02:51 UTC
    punch card don:

    With the speed of today's computers, and the tiny size of your database, speed isn't going to be an issue. Basically, you should write the cleanest code you can, to make maintenance simpler. Only after you have something and it proves to be too slow (which I don't expect to see in this case), do you look for optimizations.

    I'm not advocating being purposefully wasteful...It's just that programmer time is much more expensive than computer time....

    --roboticus