- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
请指教如何改进这个缓慢的查询。
SELECT response.`reasonid`
FROM response
INNER JOIN ACTION ON action.actionid = response.actionid
WHERE
response.respdate BETWEEN 20160305
AND 20160905
AND
(
(
response.reasonid = 'Prospect Call'
AND response.typeid = '0'
AND action.typeid = '9'
)
OR
(
response.typeid = '1000'
AND action.typeid = '1'
)
)
有索引:
response.actionid/response.reasonid/response.typeid/action.typeid/response.respdate
解释结果:
table type possible_keys key key_len ref rows Extra
ACTION range PRIMARY,idx_actiontypeid idx_actiontypeid 5 \N 310617 Using where; Using index
response ref idx_respdate2,idx_actionid, idx_actionid 5 ACTION.actionid 1 Using where
idx_reasonid,idx_resptypeid
最佳答案
您的查询不应包含单独的索引,而应包含复合索引甚至覆盖索引。令我惊讶的是,没有其他人对此发表评论。我对索引提出以下建议
表格索引响应(typeid、respdate、reasoned、actionid) Action (actionid,typeid)
然后我将查询调整为使用 UNION 而不是 OR
select distinct
r.reasonid
from
response r join action a
on r.actionid = a.actionid
AND a.typeid = 9
where
r.typeid = 0
and r.respdate between 20160305 and 20160905
and r.reasonid = 'Prospect Call'
union
select
r.reasonid
from
response r join action a
on r.actionid = a.actionid
AND a.typeid = 1
where
r.typeid = 1000
and r.respdate between 20160305 and 20160905
关于mysql - 在 where 子句中使用 OR 进行慢速查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38205538/
这是关于 Espresso 的。我在模拟器上成功运行了集成测试。我认为有些测试失败是因为它运行得太快了。有没有办法降低执行/播放速度? 最佳答案 测试失败不可能导致速度加快。 Espresso 可以将
我在 JQuery 和 JS 中有这样的函数。我有一个带有复选框的 div 列表,并将它们添加到我的列表中。这对于 40 个 div 来说效果很好,但有时我有 2,000 个 div,它会导致 Chr
我们在 Linux 环境上部署了 Websphere 版本 6.1。要打开 https 连接,我们对 java.net.URL 对象调用 openConnection() 和 connect()。 打
我有一个度量的累积总和,结构如下: Aggregate ( { NULL : [Date].[Year - Month - Date].CurrentMember } ,[Measur
我有两个基本表: CREATE TABLE IF NOT EXISTS `users` ( `id` INT(32) NOT NULL auto_increment UNIQUE, `
使用 Canvas 元素,我从一个元素到另一个元素绘制一条线另一个元素是可拖动的,当拖动该元素时,该线会跟随可拖动的元素。 我的问题是渲染速度很慢(Mac PowerBook 上的 Fx 3.5)我想
我有这个网页:http://miloarc.pyrogenicmedia.com/ 哪个atm没什么特别的。它有一些影响,但没有一个让你倾家荡产。 如果您将鼠标悬停在图 block 上,它应该会更改其
我有一个 Collection View ,可以获取我存储的图像并显示它们。但是,当我运行它时,出现内存错误和非常慢/滞后的显示。这是我的代码: var players = ["1", "2", "3
谁能给我一些关于如何让这个运行速度更快的建议? return mb_entities.prospects. FirstOrDefault(x => x.address == pers
我需要读取和处理超过1亿个文件,但我只需要读取每个文件的前4个字节,因为我只需要读取文件头。 我已经创建了一个 .net core 2.2 批处理来处理它们,并且我已经使用多线程来最大化并发处理,但是
我有一张包含用户投票的大表。我尝试了几乎所有关于 INDEX 用法的教程和文章,但在失败之后……将字段作为键的所有可能组合,但查询仍然很慢。 我可以使用任何索引来加快速度吗? (到目前为止,我不会向你
我有一个大型文档,我想为它建立索引以进行单词搜索。 (我听说这种类型的数组真的叫做索引)。目前大约需要 10 分钟。有快速的方法吗?目前我遍历每个段落,如果我找到一个我以前没有遇到过的词,我也会将它添
我尝试将我的数据保存到 MySql(本地数据库)抛出 HibernateTemplate - getHibernateTemplate().execute(new HibernateCallback(
用于涉及复杂查询的数据集分页的一些策略是什么? count(*) 需要大约 1.5 秒,所以我们不想为每个页面 View 访问数据库。目前,此查询返回了约 45k 行。 以下是我考虑过的一些方法: 缓
我有一个 Web 服务器(DMZ 中的 Windows Server 2003)使用 JDBC 连接到 Informix 数据库(在本地网络中的 Windows Server 2012 上运行)。 将
即将推出的 Redis 4 中有异步 UNLINK,但在那之前,有哪些好的替代方案可以在没有阻塞或阻塞最少的情况下实现大型键集的 DELete? 重命名为某个唯一名称后跟 EXPIRE 1 秒是一个好
我有一段 Javascript 代码可以随机更改背景图像并且工作正常,但非常粗糙。我想在图像之间进行某种过渡,我想使用 fadeIn(slow) 但不知道如何将其合并到我的代码中,有人可以帮助我吗?干
我目前正在编写一个操作,作为其中的一部分,检查并递增 orderID 值并在对话中使用它进行响应。 该代码目前可以运行,但部分执行可能需要长达 10 秒的时间才能执行,这可能会使 action-on-
我正在使用 Java 学习 Swing,很早就遇到了让我的组件在窗口中显示的问题。如果我使用以下代码: import javax.swing.*; public class win extends J
好的,所以我的托管公司已经第四次暂停我的帐户了。这让我很烦,因为他们说的代码导致了问题: # Mon Mar 5 11:00:00 2012 # Query_time: 4.028706 Lock
我是一名优秀的程序员,十分优秀!