Optimization of MySQL, where many conditions where



  • Location board, multiple filters (15-20) on real estate parameters. Each filter is one where the condition is selecting, in the end, if four to five filters are selected, then four to five conditions obtained in the secular. There are text fields like the street, the neighborhood. Can you tell me how to optimize this? Put the indices on all fields?



  • You need to look deeper - how the indices work. MySQL elects only One index - for which the sample is to be used. The index is a dop column in the table - it's not scary to read if the indices are very large. The record will be slower, but usually thermo.

    If, where we have five conditions on five fields, we'll get the maximum increase when we add the index to all five fields. In principle, if the indices for the most frequent samples are added, it will be fast enough on the volume to 10 miles.

    If more, we need to smash the table or use the NoSql solutions - which are searched very quickly on any field (including not exactly the match) on the huge rounds. For example, we used Apache Solr for a similar task, with a 10-mile base, still satisfied.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2