我有一个Pheonix表TableXXX
当我执行此查询时:
SELECT "LINENAME","XL_CDP","IL_SP","CDP_X","CDP_Y", "SAMPLES" FROM TableXXX WHERE ( "LINENAME" = 'AAA' AND "IL_SP" >= 890 AND "IL_SP" <= 9381);
上面的SQL运行缓慢,大约需要50秒钟才能得到结果。
这是此子句的解释:
+----------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------+----------------+----------------+
| PLAN | EST_BYTES_READ | EST_ROWS_READ | EST_INFO_TS |
+----------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------+----------------+----------------+
| CLIENT 1-CHUNK 1052082 ROWS 314572800 BYTES PARALLEL 1-WAY ROUND ROBIN RANGE SCAN OVER TableXXX [0,'AAA',890] - [0,'AAA',9381] | 314572800 | 1052082 | 1556459749349 |
+----------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------+----------------+----------------+
但是,如果我将SQL稍稍修改如下,只需从select子句中删除“ SAMPLE”,它将变得更快,只需大约1s。
SELECT "LINENAME","XL_CDP","IL_SP","CDP_X","CDP_Y", FROM TableXXX WHERE ( "LINENAME" IS NOT NULL AND "LINENAME" = 'AAA' AND "IL_SP" >= 890 AND "IL_SP" IS NOT NULL AND "IL_SP" <= 9381);
该SQL将返回25476条记录。
并且SAMPLE列是ARRAY类型,每条记录有24000字节。其他列只是正常大小,每列大约几个字节。
即使SAMPLES列比其他列都大,我仍然认为它应该比50s要快。
此表只有1个Region,总共有488277条记录,表总大小为12GB。
干杯