For example:

例如:

Table(id/name/code)

1/blue/1
2/red/1
4/green/1
4/../1
../../1
2552/yellow/0

would be same query to:

将是相同的查询:

$select = "SELECT * FROM table WHERE name='yellow' AND code = '0'"

than to:?

而不是:?

 $select = "SELECT * FROM table WHERE name='yellow'"

I mean, i get same results, but is it same query? better? worse?

我的意思是,我得到相同的结果,但它是相同的查询?更好?更差?

1 个解决方案

#1


3

It will depend on the indexes that are associated with the table and the amount of data in the table.

它将取决于与表关联的索引以及表中的数据量。

If there's a large amount of data and you don't have an index on the name column, but an index on the code column, you would see a greater performance improvement with the code = '0'condition.

如果存在大量数据并且您没有名称列上的索引,而是代码列上的索引,那么使用code ='0'条件会有更大的性能提升。

If you have index on each column, the distribution of data in the table will determine which index is best. If you don't have the code = '0'condition, then that index will not be evaluated.

如果每列都有索引,则表中的数据分布将确定哪个索引最佳。如果您没有code ='0'条件,则不会评估该索引。

更多相关文章

  1. mysql数据库拷贝到另一个服务器上
  2. php怎么读取MYSQL数据到radio选项
  3. MySQL可视化软件Work Bench导出导入数据库
  4. MySQL数据导入到infobright中
  5. Android如何通过JDBC直连访问MySQL数据库?
  6. flash如何自动连接mysql数据库
  7. 为获得快速结果,我的查询有什么好的索引?
  8. Mysql存储过程、索引
  9. lucene 4.10 检索mysql数据库

随机推荐

  1. 由Android想到的事情
  2. Android下的PVPlayer的实现
  3. android 4.2修改设置菜单的背景颜色
  4. 推荐几本可以深入了解android系统应用开
  5. android与WEB服务器交互时,如何保证在同一
  6. Android Shape详解
  7. Android各层推荐开发书籍及参考资料
  8. [android]android自动化测试七之动态AVD
  9. Android系统中TextView实现滚动效果
  10. Android版本和API Level