in reply to MySQL - Query vs Perl
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
|
|---|