I'm trying to get the database design right, and I'm uncertain about which of 2 options I should choose. There will be around 20 bool values that are used to filter (4 in the sample for simplicity).
- prop1
- prop2
- prop3
- prop4
Option 1)
A int(1) or varchar(1) field for each prop. The filter part of the query could be like
WHERE prop1=1 AND prop3=1 AND prop4=1
Option 2)
Using a single text field with characters representing the props
- a: prop1
- b: prop2
- c: prop3
- d: prop4
Then the filter part of the query similar to option 1 would be like
WHERE props LIKE '%a%' AND props LIKE '%c%' AND props LIKE '%d%'
or if the characters are sorted:
WHERE props LIKE '%a%' AND props LIKE '%cd%'
My thought is that option 2 makes it easier to add new props so I like this option, but will the LIKE comparator perform worse than the equality comparator? Does it make any difference to use a single text compared to multiple int(1) or varchar(1)? Any other benefits or drawback that I haven't thought of?