A
A
alex995052021-03-22 13:18:04
MySQL
alex99505, 2021-03-22 13:18:04

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

2 answer(s)
R
Romses Panagiotis, 2021-03-22
@romesses

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.

V
Vitaly Karasik, 2021-03-22
@vitaly_il1

You also need a quick search across all fields.

If this is not a fulltext search, then I advise MySQL, if fulltext - then Elastic.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question