我有一个查询(目的是创建一个视图),它使用一些连接来获取每一列.对于添加的每组连接,性能会快速降低(指数级?).
什么是使这个查询更快的好方法?请查看查询中的注释.
如果有帮助,这是使用WordPress数据库架构.
这是EXPLAIN的屏幕截图

产品表
+--+----+
|id|name|
+--+----+
|1 |test|
+--+----+
Run Code Online (Sandbox Code Playgroud)
元数据表
+----------+--------+-----+
|product_id|meta_key|value|
+----------+--------+-----+
|1 |price |9.99 |
+----------+--------+-----+
|1 |sku |ABC |
+----------+--------+-----+
Run Code Online (Sandbox Code Playgroud)
TERM_RELATIONSHIPS表
+---------+----------------+
|object_id|term_taxonomy_id|
+---------+----------------+
|1 |1 |
+---------+----------------+
|1 |2 |
+---------+----------------+
Run Code Online (Sandbox Code Playgroud)
TERM_TAXONOMY表
+----------------+-------+--------+
|term_taxonomy_id|term_id|taxonomy|
+----------------+-------+--------+
|1 |1 |size |
+----------------+-------+--------+
|2 |2 |stock |
+----------------+-------+--------+
Run Code Online (Sandbox Code Playgroud)
条款表
+-------+-----+
|term_id|name |
+-------+-----+
|1 |500mg|
+-------+-----+
|2 |10 |
+-------+-----+
Run Code Online (Sandbox Code Playgroud)
QUERY
SELECT
products.id,
products.name,
price.value AS price,
sku.value AS sku,
size.name AS size
FROM products
/* These …Run Code Online (Sandbox Code Playgroud) 在大屏幕上,我想在左侧创建一列,在右侧创建具有2个堆叠框的另一列。
在小屏幕上,这些列应堆叠为单个列。但是,框的顺序应为2、1、3。
这是一个例子:
我将flex容器设置为flex-direction: column和flex-wrap: wrap,将box 1设置为flex-basis: 100%,但这不会使后两个项目换行到下一列。
在flexbox中如何实现这种布局?
这是我到目前为止的演示:
.container {
display: flex;
flex-direction: column;
flex-wrap: wrap;
}
.cell {
background: #ccc;
border: solid 3px black;
width: 50%;
}
.cell-1 {
flex-basis: 100%;
}
@media (max-width: 500px) {
.cell {
width: 100%;
}
.cell-1 {
order: 2;
}
.cell-2 {
order: 1;
}
.cell-3 {
order: 3;
}
}Run Code Online (Sandbox Code Playgroud)
<h1>Vertical Boxes</h1>
<p>Goal: Have one box on the left, and two boxes on the …Run Code Online (Sandbox Code Playgroud)