- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有两个 MySQL 安装,一个是在带有 Xampp 的 Windows 上,另一个是在 Mac 上。机器在硬件上是相似的。
数据库是相同的,从 DUMP 文件导入到每个 MySQL 中。
我在这里发布了两个EXPLAINS EXTENDED
:
EXPLAIN EXTENDED (ON MAC)
+----+--------------------+--------------+------------+--------+--------------------------+----------+---------+---------------------------------------+------+----------+---------------------------------------------------------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+--------------------+--------------+------------+--------+--------------------------+----------+---------+---------------------------------------+------+----------+---------------------------------------------------------------+
| 1 | PRIMARY | little_tasks | NULL | ref | post_id,meta_key | meta_key | 767 | const | 620 | 0.01 | Using where; Using temporary; Using filesort; Start temporary |
| 1 | PRIMARY | exp_baby | NULL | ref | post_id,meta_key | post_id | 8 | helpeeit_helpee2.little_tasks.post_id | 12 | 0.39 | Using where |
| 1 | PRIMARY | certs | NULL | ref | post_id,meta_key | post_id | 8 | helpeeit_helpee2.little_tasks.post_id | 12 | 0.39 | Using where |
| 1 | PRIMARY | radius | NULL | ref | post_id,meta_key | post_id | 8 | helpeeit_helpee2.little_tasks.post_id | 12 | 3.00 | Using where |
| 1 | PRIMARY | exp_years | NULL | ref | post_id,meta_key | post_id | 8 | helpeeit_helpee2.little_tasks.post_id | 12 | 1.00 | Using where |
| 1 | PRIMARY | remun_max | NULL | ref | post_id,meta_key | post_id | 8 | helpeeit_helpee2.little_tasks.post_id | 12 | 1.00 | Using where |
| 1 | PRIMARY | edu | NULL | ref | post_id,meta_key | post_id | 8 | helpeeit_helpee2.little_tasks.post_id | 12 | 1.00 | Using where |
| 1 | PRIMARY | start_date | NULL | ref | post_id,meta_key | post_id | 8 | helpeeit_helpee2.little_tasks.post_id | 12 | 3.04 | Using where |
| 1 | PRIMARY | moment | NULL | ref | post_id,meta_key | post_id | 8 | helpeeit_helpee2.little_tasks.post_id | 12 | 3.04 | Using where |
| 1 | PRIMARY | lat | NULL | ref | post_id,meta_key | post_id | 8 | helpeeit_helpee2.little_tasks.post_id | 12 | 3.53 | Using where |
| 1 | PRIMARY | lon | NULL | ref | post_id,meta_key | post_id | 8 | helpeeit_helpee2.little_tasks.post_id | 12 | 3.53 | Using where |
| 1 | PRIMARY | p | NULL | eq_ref | PRIMARY,type_status_date | PRIMARY | 8 | helpeeit_helpee2.little_tasks.post_id | 1 | 24.26 | Using where; End temporary |
| 3 | DEPENDENT SUBQUERY | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | Impossible WHERE |
| 2 | SUBQUERY | spoken_lang | NULL | ref | post_id,meta_key | meta_key | 767 | const | 620 | 0.02 | Using where |
+----+--------------------+--------------+------------+--------+--------------------------+----------+---------+---------------------------------------+------+----------+---------------------------------------------------------------+
14 rows in set, 2 warnings (4 min 18,58 sec)
EXPLAIN EXTENDED (ON WINDOWS/XAMPP)
+----+--------------------+--------------+----------------+--------------------------+----------+---------+-------------------------------------+------+----------+----------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+--------------------+--------------+----------------+--------------------------+----------+---------+-------------------------------------+------+----------+----------------------------------------------+
| 1 | PRIMARY | radius | ref | post_id,meta_key | meta_key | 767 | const | 619 | 100.00 | Using where; Using temporary; Using filesort |
| 1 | PRIMARY | p | eq_ref | PRIMARY,type_status_date | PRIMARY | 8 | helpeeit_helpee2.radius.post_id | 1 | 100.00 | Using where |
| 1 | PRIMARY | exp_years | ref | post_id,meta_key | post_id | 8 | helpeeit_helpee2.p.ID | 5 | 100.00 | Using where |
| 1 | PRIMARY | start_date | ref | post_id,meta_key | post_id | 8 | helpeeit_helpee2.exp_years.post_id | 5 | 100.00 | Using where |
| 1 | PRIMARY | moment | ref | post_id,meta_key | post_id | 8 | helpeeit_helpee2.start_date.post_id | 5 | 100.00 | Using where |
| 1 | PRIMARY | lat | ref | post_id,meta_key | post_id | 8 | helpeeit_helpee2.radius.post_id | 5 | 100.00 | Using where |
| 1 | PRIMARY | lon | ref | post_id,meta_key | post_id | 8 | helpeeit_helpee2.lat.post_id | 5 | 100.00 | Using where |
| 8 | DEPENDENT SUBQUERY | edu | index_subquery | post_id,meta_key | post_id | 8 | func | 5 | 100.00 | Using where |
| 7 | DEPENDENT SUBQUERY | certs | index_subquery | post_id,meta_key | post_id | 8 | func | 5 | 100.00 | Using where |
| 6 | DEPENDENT SUBQUERY | little_tasks | index_subquery | post_id,meta_key | post_id | 8 | func | 5 | 100.00 | Using where |
| 5 | DEPENDENT SUBQUERY | exp_baby | index_subquery | post_id,meta_key | post_id | 8 | func | 5 | 100.00 | Using where |
| 4 | DEPENDENT SUBQUERY | remun_max | index_subquery | post_id,meta_key | post_id | 8 | func | 5 | 100.00 | Using where |
| 3 | DEPENDENT SUBQUERY | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | Impossible WHERE |
| 2 | DEPENDENT SUBQUERY | spoken_lang | index_subquery | post_id,meta_key | post_id | 8 | func | 5 | 100.00 | Using where |
+----+--------------------+--------------+----------------+--------------------------+----------+---------+-------------------------------------+------+----------+----------------------------------------------+
14 rows in set, 1 warning (0.03 sec)
可以自行查看执行时间在MAC上4分钟而在WINDOWS/Xampp上只有0.03秒
这是查询:
SELECT DISTINCT p.ID,p.post_author, lat.meta_value AS lat, lon.meta_value AS lon, radius.meta_value AS radius, start_date.meta_value AS date_interval, moment.meta_value AS day_moment, exp_years.meta_value AS exp_years
FROM `hlp_posts` p
INNER JOIN hlp_postmeta AS lat ON (p.ID = lat.post_id AND lat.meta_key = "hlp_latitude")
INNER JOIN hlp_postmeta AS lon ON (p.ID = lon.post_id AND lon.meta_key = "hlp_longitude")
INNER JOIN hlp_postmeta AS radius ON (p.ID = radius.post_id AND radius.meta_key = "hlp_resume_range_distance")
INNER JOIN hlp_postmeta AS start_date ON (p.ID = start_date.post_id AND start_date.meta_key = "hlp_resume_date")
INNER JOIN hlp_postmeta AS moment ON (p.ID = moment.post_id AND moment.meta_key = "hlp_resume_availability")
INNER JOIN hlp_postmeta AS exp_years ON (p.ID = exp_years.post_id AND exp_years.meta_key = 'resume_years_of_exp' AND (exp_years.meta_value >= 4))
WHERE
p.post_type = 'babysitter'
AND p.post_status = 'publish'
AND (
p.ID IN (SELECT spoken_lang.post_id FROM hlp_postmeta AS spoken_lang WHERE spoken_lang.meta_key = 'wpjobus_resume_languages' AND (spoken_lang.meta_value LIKE '%Inglese%' AND spoken_lang.meta_value LIKE '%Francese%' AND spoken_lang.meta_value LIKE '%Spagnolo%' AND spoken_lang.meta_value LIKE '%Tedesco%'))
OR
p.ID IN (SELECT native_lang.post_id FROM hlp_postmeta AS native_lang WHERE native_lang.meta_key = 'wpjobus_resume_native_language' AND native_lang.meta_key = 'wpjobus_resume_native_language' AND (native_lang.meta_value = 'Inglese' AND native_lang.meta_value = 'Francese' AND native_lang.meta_value = 'Spagnolo' AND native_lang.meta_value = 'Tedesco'))
)
AND p.ID IN (SELECT remun_max.post_id FROM hlp_postmeta AS remun_max WHERE remun_max.meta_key = 'wpjobus_resume_remuneration' AND remun_max.meta_value <= 5)
AND p.ID IN (SELECT exp_baby.post_id FROM hlp_postmeta AS exp_baby WHERE exp_baby.meta_key = 'wpjobus_resume_skills' AND (exp_baby.meta_value LIKE '%i:0%' AND exp_baby.meta_value LIKE '%i:1%' AND exp_baby.meta_value LIKE '%i:2%' AND exp_baby.meta_value LIKE '%i:3%'))
AND p.ID IN (SELECT little_tasks.post_id FROM hlp_postmeta AS little_tasks WHERE little_tasks.meta_key = 'hlp_resume_little_tasks' AND (little_tasks.meta_value LIKE '%i:0%' AND little_tasks.meta_value LIKE '%i:1%' AND little_tasks.meta_value LIKE '%i:2%' AND little_tasks.meta_value LIKE '%i:3%' AND little_tasks.meta_value LIKE '%i:4%' AND little_tasks.meta_value LIKE '%i:5%' AND little_tasks.meta_value LIKE '%i:6%'))
AND p.ID IN (SELECT certs.post_id FROM hlp_postmeta AS certs WHERE certs.meta_key = 'hlp_resume_prof_edu' AND (certs.meta_value LIKE '%i:0%' AND certs.meta_value LIKE '%i:2%' AND certs.meta_value LIKE '%i:3%' AND certs.meta_value LIKE '%i:7%' AND certs.meta_value LIKE '%i:11%'))
AND p.ID IN (SELECT edu.post_id FROM hlp_postmeta AS edu WHERE edu.meta_key = 'hlp_resume_edu' AND (edu.meta_value >= 3))
ORDER BY `p`.`ID` DESC
我真的无法解释这是怎么可能的。
最佳答案
关于mysql - 相同的数据库,不同的mysql : ENORMOUS DIFFERENCE in query time execution,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46032329/
以下哪一个更好(EJB 3 JPA) //查询 一个)。 getEntityManager().createQuery("select o from User o"); //命名查询,其中 findA
也许其他人和我有同样的问题。我遇到了错误: Cannot execute queries while other unbuffered queries are active.Consider usin
我的代码 package com.tl666.elasticsearch.pojo; import lombok.AllArgsConstructor; import lombok.Data; imp
简短版:我想查询另一个查询的结果,以便选择更有限的结果集。但是,添加 where 子句会重写第一个查询而不是处理结果,因此我得不到我需要的答案。 详情:我有两个模型,支票和蜱虫。检查 has_many
我正在尝试使用 Doctrine 在 Symfony 框架中执行原始查询。 这是代码: class MessagesHandler { /** @var \Doctrine\Common\Pe
我正在运行以下两个语句: 首先是 A) 它做它需要做的事情并工作: SELECT itemColumn ,valueColumn ,label FROM rstCombinedChartD
我有一个脚本来查询数据库以获取订单信息,然后查询该查询以获取订单总数。代码看起来像这样。 SELECT oi.OrderQty, oi.ItemPrice FROM Ord
这个问题在这里已经有了答案: MySQL Insert query doesn't work with WHERE clause (31 个答案) 关闭 4 年前。 我正在从 php 更新数据库中的
在使用 Skygear JS SDK 时,查询是否返回数组? readDummy: function(){ const Test = skygear.Record.extend('
我想在一个表上运行 MySQL 查询,然后在该表上运行子查询。我有一个对象列表。每个对象都有一个主要版本和一个次要版本。对于一个对象,我试图找到该对象的“最后版本”:这意味着我想找到该对象的最大值(主
我正在尝试在 pod 中启动 prometheus,并在 k8s 中使用持久卷。 当我启动 pod 时,我看到: level=info ts=2021-09-12T13:58:13.120Z ca
基本上,我从 kube-prometheus-stack 安装了 Prometheues-Grafana使用提供的 helm chart repo prometheus-community # hel
是否可以根据另一个查询的结果在 TFS 2010 中创建新查询? 例如,一个(父)查询选择位于某个工作项下的所有工作项(假设 ID=5 的工作项)。现在我想创建其他查询,从第一个查询的结果中选择所有错
在 Delphi 中,每当我使用 TQuery 对数据库执行 SELECT 时,我都会在 Query.Open 后面加上 try..finally,并在finally 部分中使用 Query.Clos
我只是从一台服务器移动到另一台服务器。我的脚本在旧服务器上运行良好,但是我开始在新服务器上收到此错误: "Declaration of ezSQL_mysql::query() should be c
我想问一下有什么区别 for row in session.Query(Model1): pass 和 for row in session.Query(Model1).all():
如何使用注释通过spring-data-elasticsearch进行@Query(value =“{” query“:”“}”)的聚合? 最佳答案 您不能使用@Query注释来完成此操作,该注释的唯
我有一个对可变字符串执行 LIKE 条件的查询: 当变量包含一个包含单引号的单词时,返回一些结果,但不是全部: SELECT ID FROM MyQoQ
我有我的查询范围,它返回数百条记录。我需要在 Controller 中使用不同的过滤器查询这个集合。 我怎样才能做到这一点?可能吗? 查询范围: Client::join('transactions_
我有这样的数据库模式 用户 编号 初中生 文档 编号 标题 user_id(用户的外键) 模式(可以接受 PUBLIC 或 PRIVATE) 我想检索所有公开的文档和属于给定用户(矩阵)的所有文档 我
我是一名优秀的程序员,十分优秀!