Home  >  Article  >  Backend Development  >  How to create a data table index similar to filter

How to create a data table index similar to filter

WBOY
WBOYOriginal
2016-08-20 09:04:181015browse

Snip20160818_5.png
How to create a data table index similar to filter

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)

Reply content:

Snip20160818_5.png
How to create a data table index similar to filter

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)

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn