mysql explain update,MySQL EXPLAIN UPDATE

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?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值