I am developing a website where I have modified the comment form to have review rating capabilities. I ask them to rate them on food, service and location. For each of those option there is “bad”(1),”okay”(2),”Good”(3). I store each in a custom comment field like the following “review_service”=1 & “review_food”=3.
Right now when a page loads “get_comments” is used to get all the custom comment fields and count them in the following array. The array is used to display results.
Array ( [food] => Array (  => 3  => 1  => 1 ) [service] => Array (  => 1  => 2  => 2 ) [location] => Array (  => 1  => 3  => 1 ) )
In future I want to show locations listed in order of counts. I’m sure using ‘get_comments’ through all posts is not efficient. I thought of two ideas.
Store the array (serialized) in a post custom field for the location. Each time a review is done the array in the custom field is updated.
Put the array in a custom table like below. EDIT: I forgot to add the option column.
|Id | post_id | option_id |option|option_count|
|1 |1433 |food |bad |5 |
|2 |1433 |food |good |3 |
In terms of speed/efficiency which option should I choose?