cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
29.99k stars 3.79k forks source link

sql: distsql=always mode does not error if plan cannot distribute #128627

Open michae2 opened 2 months ago

michae2 commented 2 months ago

It can be difficult to understand why a plan cannot distribute. One tool we could use to investigate this is SET distsql = always, if it caused statements that cannot distribute to fail with an error explaining why. However, it seems that this mode has never returned an error, and is functionally equivalent to distsql=on.

Here's a demonstration on v24.2.0-rc.1:

CREATE SEQUENCE seq;
SET distsql = always;
-- this does not fail, even though it must use local distribution
SELECT nextval('seq');
EXPLAIN ANALYZE SELECT nextval('seq');

It would be nice to have a distsql mode (or a variant of EXPLAIN) that helps us understand why a plan cannot distribute.

Jira issue: CRDB-41114

blathers-crl[bot] commented 2 months ago

Hi @michae2, please add branch-* labels to identify which branch(es) this C-bug affects.

:owl: Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

michae2 commented 2 months ago

Actually, I went all the way back to v2.1 and it looks like distsql=always has never returned an error. I must have been thinking of vectorize=experimental_always?

But regardless, it would be nice to have a mode like this.