Query 1:
constructor(props) {
super(props);
this.state = { controlledDate: '' };
this.handleChangeDate = this.handleChangeDate.bind(this);
}
...
render() {
...
<TableRow>
TableRowColumn>{this.state.controlledDate || New Date(Date.now())}</TableRowColumn>
</TableRow>
}
Query 2:
select c_bh,c_xzdm,c_twhbm,d_tjrq
from (
select c_bh,c_xzdm,c_twhbm,d_tjrq
from t_table
order by d_tjrq desc
) t1
limit 10
The same plan:
select c_bh,c_xzdm,c_twhbm,d_tjrq
from t_table
order by d_tjrq desc
limit 10
答案 0 :(得分:0)
在第一种情况下,PostgreSQL“扁平化”子查询,以便更好地进行优化。结果等同于第二个查询。
如果您想避免这种情况,请将OFFSET 0
之类的优化屏障放入子查询中。