Home > Database > Mysql Tutorial > body text

dba-mysql大批量更新表,如何加快更新效率?

WBOY
Release: 2016-06-06 09:42:03
Original
1045 people have browsed it

mysqldba数据库

本人设计一个项目,用到数据库大量更新操作:
update db_acc_traffic set state=1 where id=1
update db_acc_traffic set state=1 where id=2
update db_acc_traffic set state=1 where id=3
update db_acc_traffic set state=1 where id=11
其中id是主键,state是要修改的列,默认为0;现在要根据指定id修改s为1.
一次要处理上万条,一条一条执行的话效率很低。而且不支持事务,除了update外同时,另外一个线程会对db_acc_traffic进行大量insert操作。请问有什么办法提升更新效率??
求高手帮助,谢谢。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template