场景:A表中的数据迁移到C表中,但是在迁移过程中需要根据A表中的某一个数据为条件去B表中查询到,并一起放到C表中目前方案:分页查询,每次查询100条数据,首先通过sql把数据组装好,然后批量导入例子:查询sql:select t.* from (select id, name, age, (select id from tb_stu_class stu_id = id) as class_id from tb_student limit 0, 100) t
插入sql:insert into tb_student(id, name, age, class_id) values (), (), ()...问题一:一百万条数据操作,多长时间最为合适?问题二:pymysql.fetchall(),调用此方法是,一但数据为空元组,会查询很慢,这是为什么?问题二: 求一个最为合适的优化方案
添加回答
举报
0/150
提交
取消