databend icon indicating copy to clipboard operation
databend copied to clipboard

Feature: Introduce `ConstTableScan` operator to accelerate table scan with no required columns

Open leiysky opened this issue 2 years ago โ€ข 2 comments

Sometimes, we have to read data from a table while none of the columns will be used in the query.

For example:

  • select count(*) from t
  • select * from t where exists(select * from t1), none of column from t1 will be used

To accelerate such queries, we can leverage with a new operator ConstTableScan, which will retrieve a dummy column for each row of data.

leiysky avatar Aug 05 '22 15:08 leiysky

cc @sundy-li

leiysky avatar Aug 05 '22 15:08 leiysky

system.zeros

m1max.local :) select * from zeros limit 5;


โ”Œโ”€zeroโ”€โ”
โ”‚    0 โ”‚
โ”‚    0 โ”‚
โ”‚    0 โ”‚
โ”‚    0 โ”‚
โ”‚    0 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

5 rows in set. Elapsed: 0.001 sec.

sundy-li avatar Aug 05 '22 15:08 sundy-li