mysql-query中有多少个子句? [英] How many where-clauses in mysql-query is too many?

查看:77
本文介绍了mysql-query中有多少个子句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个属性"列中有一个表,其中包含许多(可能超过500个)不同的属性,并且想要查找包含多个虚数属性(〜200个)的行.查找它们的查询将包含大量的子句.

I have a table with many (maybe more than 500) different attributs in an "attribut"-column and wanted to find the rows, which contans many certan attributs (~ 200). The query to find them would contain a huge number of where-clauses.

多少个子句可以接受,并具有可接受的表现?

How many where-clauses is okay, to have an acceptable performance?

推荐答案

数量无关紧要.这是您设计数据库结构和查询问题的能力.

It's not the quantity that matters. It's how well you've designed your database structure and query that matter.

  1. 请确保您要在where查询中使用的列上都有索引

  1. Make sure you have an index on the columns that will be used in your where queries

WHERE语句放置在最先匹配最少行的顺序,然后继续进行.

Place your WHERE statements in the order that will match the least rows first and proceed like that.

此处 MySQL的WHERE子句优化指南更多提示

这篇关于mysql-query中有多少个子句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆