Answer the question
In order to leave comments, you need to log in
Best practices for storing records in a database with 30 fields and fast search?
There is a table, you need to store >= 30 fields in it (numeric, varchar - up to 255 characters), you also need to have a string field in it or by connection, where a serialized array with parameters that are not needed for searching will be stored.
At one particular moment, it is assumed that we will have about 2,000,000 records. Some will be deleted every day according to the condition, others will be added throughout the day constantly .
You also need a quick search across all fields.
Answer the question
In order to leave comments, you need to log in
If you do not need full-text search, then you can store in MySQL.
Otherwise - in full-text engines like Sphinx Search, ElasticSearch. And it is worth considering that they are not suitable for filtering criteria by numbers, as far as I know.
Option for MySQL 5.7+: store all >= 30 fields in one JSON column. Add indexes to the required fields. No problem with 2M and even more.
Some will be removed every day according to the condition, others will be added throughout the day constantly.Use partitioning by the criterion of a period of time: by days, months, years, etc. Then it will be easier to delete regularly.
You also need a quick search across all fields.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question