- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在努力更新我的庞大数据库,但由于这次大型更新/比较,我的 wamp/Heidisql 不断崩溃。
我有两个数据库表:主表“member_all”(包含 300 万条记录)和子表:“mobile_results”(包含 9,000 条记录)。表的数据库结构如下所示:
主表(“member_all”)
id int(11),
name varchar(255),
phoneWork varchar(255),
phoneMobile varchar(255),
phoneMobileNetwork varchar(255)
表中的数据如下所示:
id name phoneWork phoneMobile phoneMobileNetwork
1 bill 061090999990 0789867676 Null
3 billsaasa 06109094399990 076689867676 Null
子表:(“mobile_results”)
id int(11) autoincrement,
phoneMobile varchar(255),
phoneMobileNetwork varchar(255)
mobile_results 中的数据如下所示:
id phoneMobile phoneMobileNetwork
8789 0789867676 Orange
238789 076689867676 O2
我的 9,000 个手机号码的所有移动网络数据都存储在“mobile_results”中,但是当我尝试比较这两个表时,我陷入困境并且我的 wamp/Heidi sql 崩溃了?
我的问题是:
如何有效地使用“mobile_results”中的“phoneMobileNetwork”值填充“member_all”?
以下是我尝试过的查询:
查询 1
我使用 limit 划分查询。这很慢,而且还需要 1 周的时间来比较 mobile_results 中的 9,000 条记录。
update member_all,mobile_results
set member_all.phoneMobileNetwork=mobile_results.phoneMobileNetwork
where member_all.phoneMobile in
(SELECT phoneMobile FROM mobile_results limit 1,10);
查询 2
update member_all,mobile_results
set member_all.phoneMobileNetwork=mobile_results.phoneMobileNetwork
where member_all.phoneMobile in
(SELECT phoneMobile FROM mobile_results where id <10);
同样不适用于大量记录。
请帮助我如何一次性有效地更新我的“member_all”表的记录。
非常感谢您在这方面的帮助。
最佳答案
你可以试试这个吗。我认为使用 Exist 会更快
update member_all
set phoneMobileNetwork=
(select phoneMobileNetwork from mobile_results where
member_all.phoneMobile=mobile_results.phoneMobile)
WHERE EXISTS
(
select 1 from mobile_results where
member_all.phoneMobile=mobile_results.phoneMobile);
关于mysql - 数据库挑战: How to Update 1 million records efficiently?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24064582/
我想得到 id a b c -------------------- 1 1 100 90 6 2 50 100 ...来自: id a
让我们看看,我有这段将 NFA 自动转换为 DFA 的代码;这是我编写的;我发现了一个“bug”; printf()指令 这意味着像这样“printf("",X); ”以防止出现错误 没有要在屏幕上打
我有一些文本图像,但它们是弯曲的,呈圆形或波浪形。我需要把它们弄直。我尝试使用OCR提取文本,但是它们效率低下,需要直接的图像。 我附上测试图片: 我需要覆盖这两个最小区域。 请建议一些路径或使用
data1=data.frame("StudentID"=c(1,1,1,2,2,2,2,3,3,3,3), "Class"=c(1,1,1,1,1,1,1,2,2,2,2),
我的问题已在 java draw line as the mouse is moved 中提到过然而,我对这本书的了解还不够深入,无法涵盖 JPanels、JFrames 和 Points,正如提出这
这是我上一个问题 here. 的后续问题那里发布的答案实际上不起作用。所以这就是挑战。您将获得以下代码(假设包含 jQuery): $("input").val(**YOUR PHP /
以下是C语言中链表的语法,部分内容 struct tag-name { type member1; type member2; ....... ....... struc
我面临以下挑战性问题: There are a circle of 100 baskets in a room; the baskets are numbered in sequence from 1
我有一个这样的结构: public struct MyStruct { public string Name; public bool Process; } 我有一个这样的
假设我有: var directions = [ "name", "start_address", "end_address", "order_date" ]; 我正在尝试找到一种巧妙、快速的方法来将
我正在用 Javascript 重做 Project Euler 挑战。任务是获取最大的回文数( https://projecteuler.net/problem=4 )。现在我得到以下代码: var
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
第一问:有没有可能有一个不可见的矩形? 问题 2:是否可以在方法上调用方法?见下文。 var canvas = document.getElementById("canvas"); var ctx =
问题: 给定一串数字,计算是任何回文的字谜的子词(一致的子序列)的数量。 例子: 对于输入字符串“02002”,结果应该是 11,即: “0”、“2”、“0”、“0”、“2”、“00”、“020”、“
用户A-用户B-用户C-用户D-用户F 用'-'连接的用户互相认识。 我需要一个算法来完成这两项任务: 计算从UserX到UserY的路径 对于 UserX,计算距离不超过 3 步的所有用户。 有没有
根据我的教授介绍。对于数据库理论,没有任何例子可以说明这种情况何时会出现,考虑到它是理论的特定部分,这似乎有点奇怪。 我正在寻找的只是一个示例关系,它是第 4 范式并且可以执行第 5 范式分解。或者(
给定任务sameEnds来自 CodingBat: 给定一个字符串,返回出现在字符串开头和结尾且不重叠的最长子字符串。例如,sameEnds("abXab") 是 "ab"。 sameEnds("ab
在我的 welcome#index 页面上,有一个按钮可以远程(或者我应该说异步)为 Article 编写新的 Comment ),使用 AJAX。 它工作得很好,只是当使用rails迭代一篇文章时,
希望每个人都有美好的一天。 这是我在 Stackoverflow 上发表的第一篇文章! 我刚刚完成了 Codeacademy 上的 javascript 类(class),并且也阅读了几本相关书籍。现
挑战是删除数字末尾的零。两个数字内的零是可以的。例如: 14000 == 14 //all end zeros removed 10300 == 103 // all end zeros remove
我是一名优秀的程序员,十分优秀!