当前位置:Gxlcms > 数据库问题 > 二十二、mysql 索引

二十二、mysql 索引

时间:2021-07-01 10:21:17 帮助过:4人阅读

= connect(host=localhost,port=3306,database=jing_dong,user=root,password=mysql,charset=utf8) # 获得Cursor对象 cursor = conn.cursor() # 插入10万次数据 for i in range(100000): cursor.execute("insert into test_index values(‘ha-%d‘)" % i) # 提交数据 conn.commit() if __name__ == "__main__": main()

  5.3 查询

    开启运行时间检测:set profiling=1;

    查找第1万条数据ha-99999:select * from test_index where title=‘ha-99999‘;

    查看执行的时间:show profiles;

    为表title_index的title列创建索引:create index title_index on test_index(title(10));

    执行查询语句:select * from test_index where title=‘ha-99999‘;

    再次查看执行的时间:show profiles;

    技术图片

 

二十二、mysql 索引

标签:对象   inno   rom   选择   删除索引   localhost   exec   mit   mamicode   

人气教程排行