Skip to content

Commit 38f003d

Browse files
committed
feat: always display scan io breakdown
1 parent 46dbcbd commit 38f003d

File tree

3 files changed

+38
-3
lines changed

3 files changed

+38
-3
lines changed

src/query/sql/src/executor/format.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,9 +618,18 @@ fn append_profile_info(
618618
+ prof.statistics[ProfileStatisticsName::ScanBytesFromLocal as usize]
619619
+ prof.statistics[ProfileStatisticsName::ScanBytesFromMemory as usize];
620620

621+
let has_scan_bytes = prof.statistics[ProfileStatisticsName::ScanBytes as usize] > 0;
622+
621623
for (stat_name, desc) in get_statistics_desc().iter() {
622624
let value = prof.statistics[desc.index];
623-
if value == 0 {
625+
let always_show = matches!(
626+
stat_name,
627+
ProfileStatisticsName::ScanBytesFromRemote
628+
| ProfileStatisticsName::ScanBytesFromLocal
629+
| ProfileStatisticsName::ScanBytesFromMemory
630+
) && has_scan_bytes;
631+
632+
if value == 0 && !always_show {
624633
continue;
625634
}
626635

tests/sqllogictests/suites/mode/cluster/explain_analyze.test

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ EvalScalar
99
├── cpu time: <slt:ignore>
1010
├── output rows: 1
1111
├── output bytes: 1.00 B
12-
└── bytes scanned: 1.00 B
12+
├── bytes scanned: 1.00 B
13+
├── bytes scanned from remote: <slt:ignore>
14+
├── bytes scanned from local cache: <slt:ignore>
15+
└── bytes scanned from memory cache: <slt:ignore>
1316

1417
query T
1518
settings (max_threads = 4) EXPLAIN ANALYZE select avg(number) from numbers(1000000);
@@ -42,6 +45,9 @@ EvalScalar
4245
├── output rows: 1 million
4346
├── output bytes: 7.63 MiB
4447
├── bytes scanned: 7.63 MiB
48+
├── bytes scanned from remote: <slt:ignore>
49+
├── bytes scanned from local cache: <slt:ignore>
50+
├── bytes scanned from memory cache: <slt:ignore>
4551
├── table: default.system.numbers
4652
├── scan id: 0
4753
├── output columns: [number (#0)]
@@ -128,6 +134,8 @@ Exchange
128134
├── output rows: 6
129135
├── output bytes: 120.00 B
130136
├── bytes scanned: 120.00 B
137+
├── bytes scanned from remote: <slt:ignore>
138+
├── bytes scanned from local cache: <slt:ignore>
131139
├── bytes scanned from memory cache: <slt:ignore>
132140
├── table: default.default.article
133141
├── scan id: 0
@@ -159,6 +167,8 @@ Exchange
159167
├── output rows: 4
160168
├── output bytes: 80.00 B
161169
├── bytes scanned: 80.00 B
170+
├── bytes scanned from remote: <slt:ignore>
171+
├── bytes scanned from local cache: <slt:ignore>
162172
├── bytes scanned from memory cache: <slt:ignore>
163173
├── table: default.default.article
164174
├── scan id: 0
@@ -208,6 +218,8 @@ Exchange
208218
│ ├── output rows: 1
209219
│ ├── output bytes: 31.00 B
210220
│ ├── bytes scanned: 31.00 B
221+
│ ├── bytes scanned from remote: <slt:ignore>
222+
│ ├── bytes scanned from local cache: <slt:ignore>
211223
│ ├── bytes scanned from memory cache: <slt:ignore>
212224
│ ├── table: default.default.author
213225
│ ├── scan id: 1
@@ -225,6 +237,8 @@ Exchange
225237
├── output rows: 6
226238
├── output bytes: 120.00 B
227239
├── bytes scanned: 120.00 B
240+
├── bytes scanned from remote: <slt:ignore>
241+
├── bytes scanned from local cache: <slt:ignore>
228242
├── bytes scanned from memory cache: <slt:ignore>
229243
├── table: default.default.article
230244
├── scan id: 0

tests/sqllogictests/suites/mode/standalone/explain/explain_analyze.test

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ EvalScalar
99
├── cpu time: <slt:ignore>
1010
├── output rows: 1
1111
├── output bytes: 1.00 B
12-
└── bytes scanned: 1.00 B
12+
├── bytes scanned: 1.00 B
13+
├── bytes scanned from remote: <slt:ignore>
14+
├── bytes scanned from local cache: <slt:ignore>
15+
└── bytes scanned from memory cache: <slt:ignore>
1316

1417
query T
1518
settings (max_threads = 4) EXPLAIN ANALYZE select avg(number) from numbers(1000000);
@@ -38,6 +41,9 @@ EvalScalar
3841
├── output rows: 1 million
3942
├── output bytes: 7.63 MiB
4043
├── bytes scanned: 7.63 MiB
44+
├── bytes scanned from remote: <slt:ignore>
45+
├── bytes scanned from local cache: <slt:ignore>
46+
├── bytes scanned from memory cache: <slt:ignore>
4147
├── table: default.system.numbers
4248
├── scan id: 0
4349
├── output columns: [number (#0)]
@@ -138,6 +144,8 @@ Filter
138144
├── output rows: 4
139145
├── output bytes: 80.00 B
140146
├── bytes scanned: 80.00 B
147+
├── bytes scanned from remote: <slt:ignore>
148+
├── bytes scanned from local cache: <slt:ignore>
141149
├── bytes scanned from memory cache: <slt:ignore>
142150
├── table: default.default.article
143151
├── scan id: 0
@@ -176,6 +184,8 @@ HashJoin
176184
│ ├── output rows: 1
177185
│ ├── output bytes: 31.00 B
178186
│ ├── bytes scanned: 31.00 B
187+
│ ├── bytes scanned from remote: <slt:ignore>
188+
│ ├── bytes scanned from local cache: <slt:ignore>
179189
│ ├── bytes scanned from memory cache: <slt:ignore>
180190
│ ├── table: default.default.author
181191
│ ├── scan id: 1
@@ -193,6 +203,8 @@ HashJoin
193203
├── output rows: 6
194204
├── output bytes: 120.00 B
195205
├── bytes scanned: 120.00 B
206+
├── bytes scanned from remote: <slt:ignore>
207+
├── bytes scanned from local cache: <slt:ignore>
196208
├── bytes scanned from memory cache: <slt:ignore>
197209
├── table: default.default.article
198210
├── scan id: 0

0 commit comments

Comments
 (0)