[eluser]lifewithryan[/eluser]
Just messing around with this here, (because I'm a glutton for punishment, and bored), but just messing with that "LOCATE" query. The only thing I've noticed is that if you have to be careful on your filter string.
I created a table with 25000 cars and 40 random features (out of 80) and ran that query looking for every car that had a feature with an ID of 1 in its value string. The problem was, I searched wrong in that I did "... LOCATE('1', features). However this returned every car that had a 1 in that string. Meaning it saw 31 and since that contains a '1' it returned that car. Needless to say the query returned 24,998 records (all but TWO, that can't be right...).
I fixed it, briefly, by doing "...LOCATE(',1,', features), and that was much better finding only 9,260 records. Much better...however...what if feature 1 was at the "end" of the list? This query would skip any record that happened to have the number one at the END of the feature list since it wouldn't have a trailing comma. (We're starting to see that we're going to have to program around 'dirty data' issues in this case by making sure that our features list gets written to the DB in a very specific manner.)
I will say that MySQL is reporting rather fast response times. So now I'm going to try things via SQL and see how much of a time difference there is.
Here's a breakdown of records to queries:
LOCATE('1', features) -- 24, 998
LOCATE(',1,', features) -- 9,260
LOCATE(',1', features) -- 24,921
LOCATE('1,', features) -- 24,582
So which one of these queries tells us how many cars actually have feature 1?? I don't think ANY of them are correct, but the closest would have to be the second one. However, as stated above, that doesn't cover feature 1 being at the end of the list. Looks like we've got some cleanup to do there. So much for our Data being King...who can trust that?
Still more testing to do on my end...this is getting interesting...
Next I gotta mess with the mapping/reference/pivot table solution.