MySQL EXPLAIN UPDATE [英] MySQL EXPLAIN UPDATE

查看:403
本文介绍了MySQL EXPLAIN UPDATE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要回答下列问题,作为我的大学修订的一部分:


创建索引至少一个属性的在
'employees'数据库中,使用MySQL'EXPLAIN'工具到
清楚地显示了利润(以期限或追溯)和负数(在
条款更新)

对于第一部分,我已经在 employees 上创建了一个索引。

并且在索引之前和之后使用以下查询来证明从检索的角度看是有益的:

  EXPLAIN SELECT * FROM employees WHERE birth_date ='1953-09-02'; 

此索引具有将访问的行从30万减少到63的效果。



现在,我厌倦了如何做第二部分。我希望能够使用 EXPLAIN 命令和 UPDATE ,但它不起作用。



我试图分析的 UPDATE 查询如下:

  UPDATE employee SET first_name = first_name'WHERE birth_date ='1953-09-02'; 

这是一个合适的查询来回答问题,以及如何进行分析。



非常感谢。

解决方案

EXPLAIN UPDATE 存在于MySQL 5.6 中,但不存在于MySQL 5.5 通过比较MySQL的文档。你在MySQL 5.6服务器上尝试了吗?


I am trying to answer the following question as part of my college revision:

Create an index on at least one attribute of a table in the ‘employees’ database, where you use the MySQL ‘EXPLAIN’ tool to clearly show the benefit (in terms or retreival) and the negative (in terms of update) of the creation of the index in question.

For the first part I have created an index on the employees table and used the following query before and after the index to prove it's beneficial from a retrieval perspective:

EXPLAIN SELECT * FROM employees WHERE birth_date = '1953-09-02';

This index had the effect of reducing the accessed rows from 300,000 to just 63.

Now, i'm stumped on how to do the second part. I expected to be able to use the EXPLAIN command with UPDATE but it doesn't work for that.

The UPDATE query i'm trying to analyse is as follows:

UPDATE employee SET first_name = 'first_name' WHERE birth_date = '1953-09-02';

Is this a suitable query to answer the question and how do I go about analysing.

Many thanks in advance.

解决方案

EXPLAIN UPDATE exists in MySQL 5.6 but not MySQL 5.5 by comparing the document of MySQL. Did you try that on MySQL 5.6 server?

这篇关于MySQL EXPLAIN UPDATE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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