我必须通过窗口函数的值选择CTE。就CPU而言,内存如何选择?顺序地?
Unterminated object at character......
或嵌套
public Result index() {
// Prepare a chunked text stream
Source<ByteString, ?> source = Source.<ByteString>actorRef(256, OverflowStrategy.dropNew())
.mapMaterializedValue(sourceActor -> {
sourceActor.tell(ByteString.fromString("kiki"), null);
sourceActor.tell(ByteString.fromString("foo"), null);
sourceActor.tell(ByteString.fromString("bar"), null);
sourceActor.tell(new Status.Success(NotUsed.getInstance()), null);
return NotUsed.getInstance();
});
// Serves this stream with 200 OK
return ok().chunked(source);
}
WITH t1 AS(
SELECT col1, col2, row_number() OVER(PARTITION BY col1, col2 ORDER BY col3) rn
FROM tbl
),
t2 AS(
SELECT col1, col2
FROM t1
WHERE rn = 1
)
SELECT *
FROM t2;
不清楚。 WITH t2 AS(
WITH t1 AS(
SELECT col1, col2, row_number() OVER(PARTITION BY col1, col2 ORDER BY col3) rn
FROM tbl
)
SELECT col1, col2
FROM t1
WHERE rn = 1
)
SELECT *
FROM t2;
放在单独的CTE中,因为几个CTE中将需要此数据。到执行时间几乎没有什么不同。