clockworklabs / clockworklabs/SpacetimeDB
Reimplement: Printer for the plan, ie: EXPLAIN
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 25.2k
- Forks
- 1.1k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 46
Description
This issue tracks reimplementation of the work from stale PR #2075, which is being closed because it is too out of date to merge directly.
Original PR: https://github.com/clockworklabs/SpacetimeDB/pull/2075
Original author: @mamcx
Original branch: `mamcx/planner-printer`
Base branch: `master`
## Original PR summary
# Description of Changes
Incipient support for EXPLAIN with close plan output as in Postgres (but not yet conformant).
It has the extra capability of showing extra metadata about the schema & indexes, useful for testing & debugging.
Example:
-- Without metadata
Nested Loop
-> Index Scan using Index id 0 Unique(m.employee) on m
Index Cond: (m.employee = U64(1))
Output: m.employee, m.manager
-> Seq Scan on p
Output: p.id, p.name
Output: m.employee, m.manager, p.id, p.name
Planning Time: 541.5µs
-- With metadata
Query: SELECT m.* FROM m CROSS JOIN p WHERE m.employee = 1
Nested Loop
-> Index Scan using Index id 0 Unique(m.employee) on m
Index Cond: (m.employee = U64(1))
Output: m.employee, m.manager
-> Seq Scan on p:2
Output: p.id, p.name
Output: m.employee, m.manager, p.id, p.name
-------
Schema:
Label: m, TableId:1
Columns: employee, manager
Indexes: Index id 0 Unique(m.employee) on m, Index id 1 (m.manager) on m
Constraints: Constraint id 0: Unique(m.employee)
Label: p, TableId:3
Columns: id, name
Indexes: Index id 0 Unique(p.id) on p
Constraints: Constraint id 0: Unique(p.id)
Closes #2058.
API and ABI breaking changes
None
Expected complexity level and risk
1
Testing
-
Adding testing for both optimized or not variations of the plan
-
WILL NEED more test but is likely that we need to do another pr
## Follow-up - Reimplement this change in a fresh PR against current `master`. - Carry forward any still-relevant context from the original PR discussion and review. - Link the new implementation PR back to the original stale PR for historical context.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing stale PR #2075 and its discussion, then compare its planner-printer changes with the current master branch. Reimplement the EXPLAIN plan output, carrying forward relevant schema and index metadata where applicable. Verify both optimized and unoptimized plan output against the examples and testing expectations described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, rust, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100