sqlitebrowser / sqlitebrowser/sqlitebrowser

[Feature]: Tree-shaped output for explain query plan

Open
#3,032 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Execute SQL
Dominant language
C++
Stars
24.6k
Forks
2.4k
Avg merge
3d 49m
Merged PRs (30d)
3

Description

Describe the new feature

Currently DB Browser outputs the results of explain query plan the same way it outputs everything else - a table with rows:

id parent notused detail
2 0 0 CO-ROUTINE 2
5 2 0 CO-ROUTINE 4
7 5 0 CO-ROUTINE 1
15 7 0 SCAN TABLE Foo AS b
17 7 0 SEARCH TABLE Bar AS o USING INDEX sqlite_autoindex_Objects_1 (Baz=?)
26 7 0 USE TEMP B-TREE FOR GROUP BY
68 5 0 SCAN SUBQUERY 1 AS x
78 5 0 USE TEMP B-TREE FOR ORDER BY
94 2 0 SCAN SUBQUERY 4
160 0 0 SCAN SUBQUERY 2 AS y

This is not particularly easy to read, especially as query plans get more complex. A tree-shaped output would make things much easier to reason about and share. A plain text tree would be easy to create from the information above:

QUERY PLAN
|--CO-ROUTINE 2
|  |--CO-ROUTINE 4
|  |  |--CO-ROUTINE 1
|  |  |  |--SCAN TABLE Foo AS b
|  |  |  |--SEARCH TABLE Bar AS o USING INDEX sqlite_autoindex_Objects_1 (Baz=?)
|  |  |  `--USE TEMP B-TREE FOR GROUP BY
|  |  |--SCAN SUBQUERY 1 AS x
|  |  `--USE TEMP B-TREE FOR ORDER BY
|  `--SCAN SUBQUERY 4
`--SCAN SUBQUERY 2 AS y
Does this feature exist in another product or project? Please provide a link

Probably there is something that already outputs this format, but I'm not sure. The idea is from https://stackoverflow.com/a/71412757.

Do you have a screenshot? Please add screenshots to help explain your idea.

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no source files, tests, or entry points. Start by locating the existing handling of EXPLAIN QUERY PLAN in DB Browser and trace how its rows are rendered; done means the same plan is presented as a readable text tree with nested parent and child rows.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, sqlite
Domain
database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.