I think it depends on your needs. Perl's pretty good at splitting and joining, so I don't think you're going to run into a problem if you stick the whole chunk of data (as a string) into a single column.

I certainly wouldn't have 1,000 columns in my database table, no...

If you really want to store the values separately, then I'd turn the problem sideways and store each into a separate row, rather than a separate column.

Example: Let's say you've got a user with user ID 332. In the first version (one column), you'd have:

KEY VALUE 332 1,4,2,4,1,6,4,6,5,1,0,...

In the multi-row version, you'd have:

KEY VALUE 332 1 332 4 332 2 . . .

If you need them in a particular order, you could add a column to order against:

KEY FETCH_ORDER VALUE 332 1 1 332 2 4 332 3 2 . . .

and then retrieve them with:

SELECT VALUE FROM MYTABLE WHERE KEY = ? ORDER BY FETCH_ORDER ASC

In reply to Re: MySQL - Query vs Perl by klassa
in thread MySQL - Query vs Perl by Trihedralguy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.