Snip20160818_5.png
I want to know how to create a suitable index for a filter index like this.
You can see from the picture that the order of different types of filters is not necessarily certain. Is this type of indexing for a single field?
The database structure is roughly like this
id
goods_id (product ID)
for_who (gift object)
at_where (gift occasion)
xxxx (personality)
.... (Other fields may be expanded later)
Snip20160818_5.png
I want to know how to create a suitable index for a filter index like this.
You can see from the picture that the order of different types of filters is not necessarily certain. Is this type of indexing for a single field?
The database structure is roughly like this
id
goods_id (product ID)
for_who (gift object)
at_where (gift occasion)
xxxx (personality)
.... (Other fields may be expanded later)
Although the order is inconsistent when the user clicks, you can make the order consistent in your own program. This is the value of being a coder
For example, in your example, when you query, you will always search in the order of object, occasion, and personality, so you can just build a composite index (object, occasion, personality)