Skip to content

docs: Document cross-keyspace JOIN controls (--no-cross-keyspace-joins flag and VSchema setting)#2086

Draft
promptless[bot] wants to merge 1 commit intoprodfrom
promptless/cross-keyspace-join-controls
Draft

docs: Document cross-keyspace JOIN controls (--no-cross-keyspace-joins flag and VSchema setting)#2086
promptless[bot] wants to merge 1 commit intoprodfrom
promptless/cross-keyspace-join-controls

Conversation

@promptless
Copy link
Copy Markdown
Contributor

@promptless promptless bot commented Mar 19, 2026

Open this suggestion in Promptless to view citations and reasoning process

Documents the new feature for controlling cross-keyspace JOINs from PR #19668:

  • VTGate reference: Adds --no-cross-keyspace-joins flag
  • VSchema reference: Documents no_cross_keyspace_joins keyspace setting and explains precedence
  • Comment directives: Adds ALLOW_CROSS_KEYSPACE_JOINS directive for per-query overrides

Trigger Events

vitessio/vitess PR #19668: `vtgate`: add controls for cross-keyspace `JOIN`s

Promptless Research (7 files, 1 GitHub PR)

  • Reviewed vitessio/vitess#19668
  • Viewed .long_term_context/product_knowledge/product_overview.md
  • Viewed .long_term_context/doc_workflow/client_instructions.md
  • Viewed .long_term_context/style/client_style_guide.md
  • Viewed content/en/docs/24.0/reference/features/vschema.md
  • Viewed content/en/docs/24.0/reference/programs/vtgate/_index.md
  • Viewed content/en/docs/24.0/reference/features/mysql-query-extensions.md
  • Viewed content/en/docs/24.0/user-guides/configuration-advanced/comment-directives.md

Agent Response

I've created a documentation suggestion for the new cross-keyspace JOIN controls feature from PR #19668.

Summary

Suggestion: Document cross-keyspace JOIN controls

Changes made:

  1. VTGate reference (reference/programs/vtgate/_index.md):

    • Added --no-cross-keyspace-joins flag documentation
  2. VSchema reference (reference/features/vschema.md):

    • Added new "Controlling cross-keyspace JOINs" section covering:
      • Global control via VTGate flag
      • Per-keyspace control via no_cross_keyspace_joins VSchema setting
      • Precedence rules (VTGate flag takes priority)
      • Error message users will see
      • Per-query override with comment directive
  3. Comment Directives (user-guides/configuration-advanced/comment-directives.md):

    • Added ALLOW_CROSS_KEYSPACE_JOINS directive documentation with example

Key technical details from the PR:

  • The VTGate flag globally denies cross-keyspace JOINs for all queries
  • The VSchema setting denies cross-keyspace JOINs for specific keyspaces
  • Both can be overridden per-query with /*vt+ ALLOW_CROSS_KEYSPACE_JOINS */
  • Error message: cross-keyspace join between keyspaces 'ks1' and 'ks2' (use /*vt+ ALLOW_CROSS_KEYSPACE_JOINS */ to override)

Tip: Add or adjust Promptless's style guide in Agent Knowledge Base ✍️

--mysql-server-write-timeout duration connection write timeout
--mysql-slow-connect-warn-threshold duration Warn if it takes more than the given threshold for a mysql connection to establish
--mysql-tcp-version string Select tcp, tcp4, or tcp6 to control the socket type. (default "tcp")
--no-cross-keyspace-joins when set to true, the planner will fail instead of producing a plan that includes cross-keyspace joins
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Citation: Flag description from go/flags/endtoend/vtgate.txt in PR #19668. The flag is registered in go/vt/vtgate/vtgate.go.
View source


Typically, such a table has a canonical source in an unsharded keyspace, and the copies in the sharded keyspace are kept up-to-date through VReplication.

## Controlling cross-keyspace JOINs
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Citation: VSchema setting no_cross_keyspace_joins added to Keyspace proto in go/vt/proto/vschema/vschema.pb.go. Error message format from go/vt/vtgate/planbuilder/operators/join.go line 621. Precedence rules from PR description.
View source


This comment directive is used to override that limitation, allowing application code to be customized to allow scatters for certain chosen use-cases, but not for the general case.

## Allow cross-keyspace JOINs (`ALLOW_CROSS_KEYSPACE_JOINS`)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Citation: Comment directive ALLOW_CROSS_KEYSPACE_JOINS defined in go/vt/sqlparser/comments.go. Example query format from PR description and test files in go/test/endtoend/vtgate/queries/no_cross_keyspace_joins/.
View source

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 19, 2026

Deploy Preview for vitess ready!

Name Link
🔨 Latest commit fba8ccf
🔍 Latest deploy log https://app.netlify.com/projects/vitess/deploys/69bc522e1301040008029eea
😎 Deploy Preview https://deploy-preview-2086--vitess.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants