-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: vectorize COALESCE expressions #66015
Copy link
Copy link
Closed
Labels
A-sql-executionRelating to SQL execution.Relating to SQL execution.C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)E-starterMight be suitable for a starter project for new employees or team members.Might be suitable for a starter project for new employees or team members.T-sql-queriesSQL Queries TeamSQL Queries Team
Description
Continuing the campaign to vectorize all expressions, it would be great to have a vectorized implementation of CoalesceExpr. Here's a demonstration:
demo@127.0.0.1:26257/movr> EXPLAIN (VERBOSE) SELECT COALESCE(vehicle_city, start_address, end_address) FROM rides;
info
-------------------------------------------------------------------------------------
distribution: full
vectorized: true
• render
│ columns: ("coalesce")
│ estimated row count: 500
│ render coalesce: COALESCE(vehicle_city, start_address, end_address)
│
└── • scan
columns: (vehicle_city, start_address, end_address)
estimated row count: 500 (100% of the table; stats collected 2 minutes ago)
table: rides@primary
spans: FULL SCAN
(13 rows)
Time: 1ms total (execution 1ms / network 0ms)
demo@127.0.0.1:26257/movr> EXPLAIN (VEC, VERBOSE) SELECT COALESCE(vehicle_city, start_address, end_address) FROM rides;
info
-------------------------------------------
│
└ Node 1
└ *colflow.BatchFlowCoordinator
└ *colexec.Columnarizer
└ *rowexec.noopProcessor
└ *colexec.Materializer
└ *colexecutils.CancelChecker
└ *colfetcher.ColBatchScan
(8 rows)
Time: 1ms total (execution 1ms / network 0ms)
If we had a vectorized CoalesceExpr we wouldn't need the wrapped rowexec.noopProcessor.
Jira issue: CRDB-7850
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-sql-executionRelating to SQL execution.Relating to SQL execution.C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)E-starterMight be suitable for a starter project for new employees or team members.Might be suitable for a starter project for new employees or team members.T-sql-queriesSQL Queries TeamSQL Queries Team
Type
Projects
Status
Done