punch_card_don has asked for the wisdom of the Perl Monks concerning the following question:
Is there any good reason to prefer a Perl or a Mysql solution to the following issue:
A user is going to submit multiple option choices via a web form. Say one through N. They will be submitting these choices regularly, and I want to keep track of what their choices were each time. They will be stored in a Mysql database, but I see two possiblities:
1. Give this update event a unique identifier, create an 'options' table with columns 'update_id' and 'option', and store a separate update_id - option_id pair for each option chosen. That is, if the user selects 5 options on Monday, ther ewill be 5 rows inserted into the table, each with Monday's update id. To retireve the options selected on Monday, I select all rows that have Monday's update id.
2. Pre-agglomerate the options in Perl into a formatted string, such as 1|2|5|8|13|55, and store that in a single inserted row. To retrieve Monday's selections, I select the single row with Monday's update id and do a split.
There are about 1,000 users, and each will be making about 6 updates per year, making about 5 to 10 option selections per update. And I have to keep the data for 7 years. So version 1 could end up with ~1/4-million rows, where as version 2 will have ~1/5 ~ 1/10th that, but require the extra Perl.
Speed of retrieval is not critial, per se, but neither will it look good if my system chunks along like a tug boat. So, which is likely to be faster?
Thanks.
|
|---|