两眼一抹黑

博客园 首页 联系 订阅 管理

普通增删改查

表结构及数据都极其简单,命名也及其不讲究。均为默认配置,mysql表默认InnoDB引擎。表x包含三个int字段a b c,100W条数据均a=1 b=2 c=3

sql语句

建表:

create table x (a int, b int, c int);

插入数据(从文本中导入):

-- mysql
load
data local infile "data.txt" into table x;
-- pg
copy x from ‘data.txt’;

查询数据

select * from x where a = 2;

更新数据:

update x set c = 4 where a = 2;

删除数据:

delete from x;

数据对比

  mysql pg 对比
insert×100w 2.8~3.5s 500~600ms pg速度为mysql5倍
select 250ms 63ms pg速度为mysql4倍
update 370ms 78ms pg速度为mysql4.7倍
delete 4~5s 1.8~2.5ms pg速度为mysql2倍

未完……“可能”待续(更多层面的比较)……

posted on 2017-10-24 15:07  两眼一抹黑  阅读(781)  评论(0编辑  收藏  举报