This guide describes what DB-G already supports, where to find it, and its boundaries, organized by feature area. For the short overview see README.en.md; for plans and unfinished work see Roadmap.md. UI copy follows Settings → Appearance → Language.
1. Data sources and connections
1.1 Supported data sources
| Data source | Access | Writes | Multiple schemas / databases | Execution plan |
|---|---|---|---|---|
| SQLite | Local file | Writable; results editable | — | EXPLAIN QUERY PLAN |
| MySQL | TCP | Writable; results editable | Switch database | JSON / TREE |
| PostgreSQL | pgx | Writable; results editable | Switch “database.schema” | JSON |
| ClickHouse | native / HTTP / HTTPS | Read-only | Switch database | JSON |
| rqlite | HTTP API | SQL writable; result editing off | — | SQLite dialect |
Shared capabilities:
- Connect, execute, object tree, column catalog (including primary keys), completion and result export.
- Every data source supports object DDL viewing and table statistics: estimated row/column counts,
data and index size, plus the SQL that was actually run. The exact
COUNT(*)is provided only as a commented statement, never executed automatically; the SQL is collapsed by default and copyable. - Index lists: MySQL / PostgreSQL / SQLite / rqlite; ClickHouse returns an empty list.
- Foreign keys: SQLite / MySQL / PostgreSQL / rqlite implement foreign-key lookup, used only for one-hop expansion in AI retrieval, never on the completion or object-tree hot path; ClickHouse has none.
- MySQL can lazily load objects and columns per database even without a default database. PostgreSQL / MySQL / ClickHouse can switch schema/database from the top bar (MySQL/CK show the database name, PG shows “database.schema”); completion, DDL and unqualified table queries follow the current schema.
- Transport encryption: every data source except local SQLite can enable SSL/TLS, specify a custom CA (PEM), and choose whether to skip certificate verification (self-signed debugging only). ClickHouse HTTPS implies TLS.
- rqlite accepts a read-consistency level and server timeout in its connection parameters.
1.2 Connection management
- Connection profiles persist in
connections.json; create, edit, delete, status dots and parent folders all live in the sidebar. - No data source is connected at startup. Clicking a sidebar data source connects it and expands the tree; the top-bar connection switch toggles connect/disconnect. After disconnecting, loaded trees are kept and refreshed on demand.
- Connections are opened on demand; at most 6 sessions stay open, evicted by LRU. Sessions currently running a statement are never closed.
- Folders can be nested: create, rename, delete, with duplicate names blocked per level. Deleting a folder moves its connections and subfolders to the parent.
- Sidebar search filters by connection name, folder name and already-loaded object names, and auto-expands matches (loaded objects only).
- Ctrl+drag reorders connections/folders and drops connections or folders into folders.
- Connection row context menu: refresh metadata, edit, Duplicate data source (copy in the same folder, name deduplicated automatically), Delete connection (asks for confirmation).
- The connection dialog configures: name, kind, target address/file, parent folder, query timeout, TLS, tags and the connection-level AI context policy (schema + current SQL only).
- Query timeout is per data source: empty/0 means the default 30 seconds, up to 24 hours. On timeout the driver statement is cancelled and the result pane shows “Query timed out (Ns), cancelled”.
- Up to 3 colored tags per data source: type and press Enter to add (fuzzy search reuses existing tags), × removes, clicking the color swatch cycles colors. Tags appear in the result status bar.
- “Copy” in the connection dialog copies
key: valuepairs, including the plaintext password. “Test connection” can be cancelled while waiting. - Status dots: grey = not connected, yellow = connecting, green = connected, red = last open failed (hover for the reason).
- Connection passwords are encrypted on this machine with AES-256-GCM (key
<config>/db-g/secret.key, 0600). Existing plaintext is encrypted and written back on load; if a changed key cannot decrypt, the app warns and asks you to re-enter.
1.3 Large catalogs and caching
- Object-group counts are loaded first; groups load pages on expand: 1000 per page, at most 5000 per group, all on background threads.
- The completion catalog reads at most the first 2000 entries, so databases with tens of thousands of tables do not freeze the UI or completion.
- Metadata cache:
<config>/db-g/meta/<connID>.json, 24-hour TTL. Expanding is query-free while the connection fingerprint matches; stale data is used first and refreshed in the background. Deleting a connection, changing the target address or using “Reload object tree” clears the cache.
2. Consoles, workspaces and external files
2.1 Consoles and workspaces
- Each data source can have multiple named consoles, each backed by
~/.config/db-g/consoles/<connectionID>-<consoleID>.sql. - Debounced auto-save (default 5 seconds, range 1–60),
Ctrl+Ssaves immediately; restart restores the workspace, console text and cursor. - Closing a tab (×) only removes it from the current workspace; the file stays. The context-menu
“Delete…” removes both metadata and
.sql. The sidebar lists every console of each data source so you can reopen them. - Tabs show “data source / console” (console name omitted when there is only one). Overflowing tabs scroll horizontally; the workspace switcher stays visible; new consoles are created only from the sidebar entry under each data source.
- Ctrl+drag a tab reorders it within the workspace; Ctrl+Tab switches between the two most recently used consoles (Alt-Tab style).
- Tab settings (gear at the left of the tab row): tab position top/left/right. In left/right layouts
the tabs become a separate panel with a control row (new/search/settings/collapse) and searchable,
Ctrl-draggable console rows; collapsed, only data-source kind icons remain (hover for the full name).
The panel divider is draggable and its width is remembered with the position (
console.json).
2.2 External SQL files
- Drop a
.sqlfile or use “Open SQL file…” in the top bar, pick a data source, and it opens as a temporary console. The same path is reused; the file is never copied. - Limit 8 MiB; non-UTF-8, NUL-containing or non-
.sqlfiles are rejected. - Writes preserve the original BOM, line-ending style and permissions; edits are debounce-saved back.
- Disk changes are checked every second, on window focus, and before execute/save: a clean buffer reloads automatically; with local edits autosave pauses and a banner offers “Reload / Keep local / Save as…”, while execute/save asks first.
- The tab context menu “Reload” manually reloads from disk, confirming first when there are unsaved edits.
- Writes verify the on-disk content and never overwrite an external edit; a missing file is not silently recreated (offer recreate/save-as) and is removed from the workspace at startup. Deleting the console only unbinds it and keeps the user's file.
- Command line
db-g -o /path/to/aa.sql(repeatable-o) is equivalent to dropping the file. If an instance is already running, the file is handed over through local IPC and the existing window is focused.db-g -versionprints the version.
3. Editor
- Built on mygo
ui/editor: SQL highlighting, line numbers,Ctrl+Ffind/replace, code folding, multi-cursor and undo. - Viewport layout for millions of lines; benchmarks are in
docs/spike-results.mdsection A1. - The editor/result split follows window height;
Alt+Dshows or hides the result pane at any time. - Highlighting and completion share the same dialect vocabulary: MySQL
AUTO_INCREMENT/ENGINE/GROUP_CONCAT, PostgreSQLRETURNING/SERIAL, ClickHouseLowCardinality/DateTime64, SQLiteAUTOINCREMENT, etc. - Line shortcuts:
Ctrl+Yduplicates the current line,Ctrl+Ddeletes the current line/selection,Ctrl+/comments or uncomments the current line (moves down one line with a single cursor). - Conservative SQL formatting (
Ctrl+Shift+F): only whitespace and keyword case, undoable. - Execution: a selection runs the statements split from the selection; without a selection only the statement under the cursor runs, never the whole console by accident.
- For multi-statement runs, the editor gutter marks each statement's state.
4. Execution, results and history
4.1 Execution
Ctrl+EnterorF5executes. Queries run in the background, the UI stays interactive, and execution can be stopped/cancelled.- Multiple statements run sequentially, stopping at the first error; each statement gets a result tab and a gutter state.
- Query timeout is configured per connection (see 1.2).
- The active console is saved before execution (external files check for disk conflicts first).
4.2 Result grid
- Virtualized grid: row numbers, truncation badge, error banner, stop/cancel, and a 1 MiB per-cell limit.
- Result budget defaults to 8 MB and is configurable; page size defaults to 500 rows (range 50–5000), with paging and an explicit total row count.
- Cell-level selection: two-level highlighting (selected cell darkest, its row lighter, other rows
zebra-striped);
Ctrl+Ccopies the selection (a single cell copies just that cell); whole-row copy and context-menu “Copy row → INSERT” are available. Ctrl+Shift+Nsets selected cells (including multiple cells) to NULL; primary-key/read-only and NOT NULL columns are skipped automatically.- Right-click a multi-row/multi-column selection: Copy selection (TSV / TSV with header / CSV) or Export selection (CSV / JSON / JSONL / SQL INSERT).
- Right-click a header to sort (NULLs last) and filter per column.
- Fetch more appends later rows through a derived-table page query.
- Cells render only the first 512 characters (long text ends with
…to avoid laying out huge fields every frame); copy, viewer and editor always use the full content. - View full content: double-click a cell. Valid JSON renders as a collapsible tree (sorted keys, expand/collapse, type coloring); other content shows as text. Copy/close buttons sit in the title bar, auto-wrap toggles left of Copy, and the bottom-right corner resizes the dialog. Initial size adapts to content (small for short text, up to 880×660 for long text/complex JSON).
- Ctrl+double-click to edit: short content edits inline in the grid (Enter/blur commits, Escape cancels); long or multi-line content opens a resizable editor of the same size as the viewer.
- MySQL
DATETIME/TIMESTAMPdisplay and copy uniformly asYYYY-MM-DD HH:MM:SS[.ffffff]; “Copy row → INSERT” uses that literal.DATEand other data sources keep their original format.
4.3 Result tabs and toolbar
- Pin results: the pin button fixes a query result as the leftmost result tab (query results only, up to 10). Pinned tabs stay on the left across new runs while new results append to the right; each console keeps its own pins, which are in-memory and disappear on restart.
- Refresh query: the leftmost toolbar button re-runs the SQL behind that result in the same tab. It is hidden for write statements/DDL and other runs without a result set.
- Result visibility: the rightmost toolbar buttons maximize (fill the console, cover the editor) or
hide the pane (
Alt+Ddoes the same). While hidden, a borderless restore button with the same icon floats in the bottom-right corner. On startup (no connection, no run) the pane starts collapsed and expands automatically on the first statement.
4.4 Status bar
A permanent status bar at the bottom of the result pane shows the current database name, data-source version (read asynchronously after connecting), data-source tags, and the last run's timing (queries split “execute / read”, with the driver reporting read progress). It stays visible in the execution-plan view.
4.5 SQL history
- One
history/<connectionID>.jsonlper data source, capped at 5000 entries with a lazy trim at 6000. - The panel shows the latest 100 with insert/copy; the full file is available directly.
4.6 Result export
- Export current result: CSV / JSON / JSONL / SQL INSERT.
- Full streaming export re-runs the query and writes as it reads, not limited to the current page. Progress and written-row count appear next to the button; closing the window asks first. After success, double-click the status row to reveal the file in the system file manager.
- Selection export is covered in 4.2.
5. Object tree, table views and DDL
5.1 Object tree
- Groups load on demand (see 1.3). Double-clicking an object inserts preview SQL: it reuses an existing
console for that data source and appends a semicolon-terminated
SELECT ... LIMIT 200, creating a console only when none exists. It is never run automatically. - Right-click “View DDL”;
Ctrl+click an object in the tree,Ctrl+click a table/view name in the editor, or select an object and pressCtrl+Q. - DDL opens in a read-only SQL editor: conservative formatting, syntax highlighting, and mouse-selection copy.
- Table context menu “View statistics”: see 1.1. The dialog includes the SQL actually run and the exact
COUNT(*)statement that was not executed.
5.2 Table view tabs
- Double-click a table/view to open a temporary tab (Data / Structure / DDL).
connID|schema|name|kindis unique; double-clicking again only activates it. Nothing is written toconnections.json/consoles/; it disappears on exit. - The Data page uses server-side SQL:
SELECT * FROM <object> [WHERE] [ORDER BY] LIMIT/OFFSET. WHERE is user input and must split into exactly one statement before it is sent. - The Data page supports column sorting, paging and direct grid editing committed in one transaction. It keeps editability but hides pin, rerun and full export.
- The Structure page shows columns (name/type/nullable/primary key/comment) and indexes (name/columns/unique/primary/type/condition).
- Copy SQL or send it to a console in one click.
- Console actions (execute/save/format/AI) do not apply in table views;
Ctrl+Enterrefreshes the Data page andCtrl+Qswitches to DDL. - Deleting a connection or a sync refresh closes the corresponding table view tabs.
5.3 Data-source monitor
- Right-click a data source in the sidebar and choose Monitor to open a transient tab (not persisted, one per connection; opening it again only activates the existing tab).
- Overview: server identity/version, connections, running sessions, QPS/TPS, traffic, cache hit, CPU/memory when the data source exposes them, uptime; trends over the last 60 samples; a collapsible, searchable raw-status table.
- Refresh interval: off / 1 / 2 / 5 / 10 seconds, default 5s. Polling stops while the tab is hidden; failures back off at 3/6/12/30 seconds and a manual refresh resets it.
- Processes: search by PID/user/database/state/wait/SQL, sort by column, show only running sessions (or all sessions), inspect the full SQL, or Kill selected query after confirmation (the connection stays open).
- Support matrix: full monitoring for PostgreSQL / MySQL / ClickHouse; rqlite shows
/statusnode and runtime information; SQLite shows file size, pages andjournal_mode. - PostgreSQL/MySQL CPU and PostgreSQL memory have no reliable SQL source and display “not supported”;
MySQL memory depends on
sys.memory_global_totalorperformance_schema. - The monitor uses its own connection, separate from console sessions; deleting a connection, changing its target, syncing, or disconnecting closes the monitor.
6. Data writes
- Result editing requires all of: a single table, the primary key present in the result columns, and
a session that declares
CapEditableResultand implements transactions (SQLite / MySQL / PostgreSQL; rqlite / ClickHouse do not). - Operations:
Ctrl+double-clickedits a cell (inline for short content, dialog for long), add row, delete row, undo. New rows can edit any column (including primary-key columns); empty columns use database defaults; new rows can be removed directly. - Undo/commit appear next to the delete-row button only after data was actually changed.
- Before committing, every statement is previewed as parameterized SQL and executed in one transaction; if the affected row count ≠ 1, everything rolls back.
- JOINs / views / missing primary key / aliased expression columns are read-only, and the toolbar shows why.
- Writes are still subject to the destructive-SQL check (see 9).
7. Completion and execution plans
7.1 SQL completion
- SQL keywords/functions/types plus tables/views of the current data source; pops up while typing,
Ctrl+Spacetriggers explicitly. - Table/view catalogs are cached per connection (5-minute TTL); Settings in the top bar offers “Refresh completion cache”.
- Keywords/types/functions follow the data-source dialect (see 3).
- Column completion follows the tables referenced by the statement/subquery under the cursor
(FROM · JOIN · UPDATE · INTO, with multi-table JOINs, aliases and CTE expansion). Columns are still
offered inside function/expression parentheses (
sum,avg,coalesce,WHERE (…)); no columns when the statement references no table. - After FROM/JOIN/UPDATE/INTO, table/view names are offered first while typing a relation name.
- Adjacent statements missing a semicolon are separated at line-leading
SELECT/INSERTkeywords, so the next statement's tables do not leak into the current completion. - The completion catalog reads at most 2000 entries (see 1.3).
7.2 Inline AI completion
- Press
Alt+\in the editor or click “AI completion” in the toolbar to request a suggestion from the current statement/cursor context. - The suggestion appears first in the completion menu (Detail “AI”) and is inserted only with Tab; stale suggestions are dropped when the cursor or document version changes.
7.3 Execution plans
- The top-bar “Execution plan” action
EXPLAINs the current statement/selection and shows a unified plan tree; nodes are colored by cost and show estimated rows, actual time/rows/loops, and PostgreSQL BUFFERS. - Supports SQLite
EXPLAIN QUERY PLAN, PostgreSQL JSON, MySQL JSON/TREE and ClickHouse JSON; parsing failures fall back to the raw result. - ANALYZE asks every time and is limited to SELECT/WITH; only PostgreSQL / MySQL show “ANALYZE rerun” (SQLite / ClickHouse / rqlite do not).
- The plan tree can be sent to AI for diagnosis.
8. AI assistant
8.1 Chat-to-SQL and service configuration
- A collapsible, resizable right-side panel; local Ollama by default, or any OpenAI-compatible service.
- Settings → AI takes the base URL and API key, then fetches the model list through the OpenAI
/modelsendpoint; if that fails or returns nothing, manual model entry remains. The API key is encrypted locally. - Replies stream; generated SQL enters the editor only when the user clicks “Insert SQL”.
- Each connection can enable “AI sends only schema and current SQL”, overriding the global DDL/sample/ history/error switches.
8.2 Context, privacy and budget
- By default only schema + the current SQL are sent; history, error logs, sample rows and DDL are opt-in.
- The model context window is configurable (0 = 8192); prompts are trimmed by budget in layers (samples → history → errors → conversation → DDL → columns → tables → SQL/plan text).
- Schema uses a compact one-line format with foreign keys after columns; provider-reported prompt tokens calibrate later budgets, and the panel shows estimated/actual tokens plus session totals.
- “Preview context” shows the full prompt before sending; “View context” keeps the last 12 AI requests (chat/fix/completion/plan/rewrite), memory only, never logged or written to disk.
- Preview toggles can disable DDL/samples/history/errors for the current request only.
- Retrieval uses table/column names, the current SQL, Chinese/English tokens and real foreign keys for one-hop expansion.
- The current result sends only columns/row count/duration by default; sample rows and related-table DDL are opt-in; the plan tree is included when the plan panel is open.
- Requests have a connect timeout and a 60-second idle watchdog; a failed first packet is retried once.
- History/errors are sent only when enabled and are redacted for URL credentials, Bearer tokens and password/token key-values.
- Long conversations keep the last 8 messages plus a deterministic summary of earlier questions; each request carries the last 8 messages (~4 turns), dropping the oldest when over budget while always keeping the current question.
- AI replies follow the interface language.
8.3 Generated-SQL self-check and insertion
- Before inserting/fixing/rewriting, generated SQL is checked locally against the loaded catalog: missing tables/columns produce warnings only, never a block, and destructive rules are applied too.
- Clicking a yellow/red warning opens the full report (issues, rules, SQL, copy).
8.4 Rewrite and error fix
- AI rewrite: select SQL in the editor and press
Ctrl+K(without a selection, the statement under the cursor) to open a dialog; describe the goal (e.g. “keep only needed columns”, “make it parameterized”) and pressCtrl+Enter. A diff is previewed; “Replace selection” or “Append after selection” is confirmed by the user, and application is refused if the original text changed. Generated SQL is never run automatically. Each rewrite is recorded in the AI assistant's conversation history (title starts with the rewrite request); execution history still records only real runs. - SQL error fix: “AI fix” on a failed-execution banner sends the failed SQL, driver error and involved table schemas. The suggestion is shown as a diff and only applied after “Apply fix” or “Apply and run”; a reply without a SQL code block is reported as an error.
8.5 Conversations and task parameters
- Conversations are saved per workspace (
ai/conversations/<workspaceID>.json), with multiple histories (search, scroll paging); only text is stored, no context snapshots or sample rows. - Titles truncate the first message by default; AI-generated titles can be enabled in Settings.
- Settings support task-level completion/fix models, chat temperature and per-task output limits (chat/completion/fix/rewrite Max Tokens).
- The AI panel shows this request's prompt/completion/total tokens and the session total.
9. SQL safety
- Local deterministic rules flag UPDATE/DELETE without WHERE, tautological conditions, and DROP/TRUNCATE.
- A dialog warns by default; a connection profile can enable “block destructive SQL”.
- AI is never in the allow/deny path, only used for explanation; AI self-check applies the same rules.
10. Import, export and Git sync
10.1 Connection profile export/import
.dbgbinary (PBKDF2 + AES-GCM); exports include passwords and require a passphrase; import needs the same passphrase.- Imports deduplicate and remap conflicting ids; available in Settings → Workspace.
10.2 DataGrip project import
- Reads a DataGrip project
.idea(dataSources.xml+dataSources.local.xml), imports connections and copies associated SQL consoles; deduplicated per target and idempotent on repeated imports.
10.3 Git sync
- Settings → Sync takes a repository URL, custom branch and SSH private key (empty uses the system ssh/agent); “Pull” / “Commit and push” synchronize both ways.
- Synced: connections, folders, workspaces and internal console SQL.
- Not synced: external-file consoles, execution history, caches, cursor, theme/shortcuts/AI config.
- Connection data is encrypted as a whole with AES-GCM inside the repo
(
db-g/connections/<id>.enc); console SQL is plaintext. - Local
sync.keyand repokey.kcvdouble-check the key; a wrong key aborts before decrypting/committing. - Before committing, SQL is scanned for suspected plaintext credentials (URL credentials, DDL passwords, private keys, known key prefixes, etc.) and requires a second confirmation on a hit. Placeholders, variables and column names do not produce false positives, and confirmed items are deduplicated by HMAC fingerprint.
- The first pull clones the repo, checks out the configured branch and imports; later pulls fetch/merge then import.
- Pull never deletes local-only data (same ids use the remote version; everything else is kept with a count notice and can coexist on the next commit).
- Commit is local snapshot commit → merge remote (abort on conflict) → push; empty repos and first overwrites have guards.
10.4 Query result export
CSV / JSON / JSONL / SQL INSERT, selection export and full streaming export are described in 4.2 and 4.6.
11. Appearance, fonts, language and windows
11.1 Appearance
- Unified color and hierarchy based on Lobe UI design tokens (generated in light/dark pairs).
- Follow system / light / dark; color schemes (Default/Ocean/Forest/Sunset/Custom); Custom sets light and dark background/container/border/text/muted text separately; accent color (Default/presets/custom hex).
- Density, corner radius and UI font size apply immediately and save to
theme.json; Settings → Appearance previews live. - GPU rendering can be disabled in favor of CPU rasterization (takes effect after restart; works around black-screen flicker on some Linux/X11 drivers).
- Theme files can be exported/imported (with app/version validation, colors included, invalid fields ignored individually).
- The system title bar is hidden; a draggable custom title bar (double-click maximizes) sits at the top with open SQL, history, AI assistant, settings and minimize/maximize/close on the right. Frameless windows are clipped to the theme radius (macOS / Windows 11); Windows keeps left/right/bottom resize edges.
11.2 Fonts
Four font sets: editor, result grid, console tabs and the rest of the UI (family + size; the UI size follows
Appearance). Changes apply immediately and save to fonts.json (old editor.json migrates automatically).
11.3 Interface language
- Settings → Appearance, first item: System / 简体中文 / English, applied immediately and saved to
locale.json. - Covers the main window, every dialog, settings, the AI panel, sync and error messages, and the update window; AI replies follow the interface language.
- Copy lives in
locales/en.json(source) andlocales/zh-Hans.json;make i18n-checkreports untranslated copy and catalog drift. - Logs, driver/database server errors, SQL/identifiers/data and persisted enum IDs are not translated.
11.4 Window state
The normal position/size of the main and settings windows is saved on exit and restored on startup
(window-state.json); release and development builds use separate directories.
12. Settings window
- Left/right layout: Appearance (including language) / Fonts / Workspace / AI / Shortcuts / Sync / Debug, with the version in the bottom-left corner.
- “Workspace” groups result settings, console autosave, profile export/import and DataGrip import; “Debug” groups the log entry point and developer tools.
- The same frameless custom title bar as the main window (draggable, double-click maximizes); size and
position are remembered in
window-state.json. - The top-bar “Settings” button opens a singleton settings window.
13. Shortcuts
All actions live in one action table; Settings → Shortcuts can “Record” a new binding. Conflicting bindings
in the same scope automatically unbind the old action. Only non-default actions are saved to keymap.json.
| Action | Default keys | Scope |
|---|---|---|
| Execute | Ctrl+Enter / F5 |
Global |
| Save console | Ctrl+S |
Global |
| Command palette | Ctrl+P |
Global |
| Switch to recent console | Ctrl+Tab |
Global |
| Toggle result pane | Alt+D |
Global |
| View DDL of selected object | Ctrl+Q |
Global |
| Copy cell | Ctrl+C |
Results |
| Set selected cell to NULL | Ctrl+Shift+N |
Results |
| Duplicate current line | Ctrl+Y |
Editor |
| Delete current line/selection | Ctrl+D |
Editor |
| Comment/uncomment | Ctrl+/ |
Editor |
| Format | Ctrl+Shift+F |
Editor |
| Trigger completion | Ctrl+Space |
Editor |
| Inline AI completion | Alt+\ |
Editor |
| AI rewrite selected SQL | Ctrl+K |
Editor |
| Find/replace | Ctrl+F |
Editor |
Result-grid double-click gestures are rebindable too: double-click previews full content by default, and
Ctrl+double-click edits a cell.
The command palette searches actions, consoles and SQL inside consoles.
14. Logging and diagnostics
- Logs live in
~/.config/db-g/logs/YYYY-MM/YYYY-MM-DD_N.log: plain text (time, level, tag, message, key=value), one file per launch, mode 0600. - Records startup / connect / execute (SQL truncated to 200 characters, results never logged) / console / completion load failures / panic stacks. DSNs and password fields are redacted automatically; AI logs only provider/model/duration/tokens, never prompt bodies, API keys or DSNs.
- Settings → Debug opens the log directory; a log write failure never breaks the app.
- Background/non-active-console errors appear as bottom toasts (4-second auto-dismiss, hover pauses, closable); per-data-source failure reasons appear in the sidebar red-dot tooltip.
- Developer tools at the end of Debug: editor info (lines/bytes/version) and 3k/12k/100k demo presets (written to the active console and saved immediately, for performance testing).
15. Install, release and updates
- Release builds use mygo: pushing a
v*tag makes GitHub Actions build Linux/Windows in parallel, sign the update archives and publish a Release. The app ships mygo's native update window, checks automatically, downloads, verifies signatures and applies the update on next launch. - Linux self-install/upgrade (release builds only): when
~/.config/db-g/bin/db-gorversionis missing, or the running version is newer, an install/upgrade icon appears next to Settings in the top bar. Confirming atomically copies the current executable tobin/db-g, writesversion(build=10000plus the display version), and creates~/.local/share/applications/db-g.desktopand~/.local/share/icons/db-g.png(the desktop entry uses the icon's absolute path, so no icon-cache refresh is needed). Paths honorXDG_CONFIG_HOME/XDG_DATA_HOME. - The Windows installer supports per-user install and signed auto-updates; Linux ships tar.gz (with
install.sh) and.deb. - Configuration, logs and consoles live in
~/.config/db-g/(%AppData%\db-g\on Windows); development builds use~/.config/db-g.dev/.
16. Performance and known limits
- The editor supports viewport layout for millions of lines; editor and result-grid benchmarks require a 100k-row frame p50 < 16ms.
- Objects load page by page with a 24-hour disk cache; the completion catalog is capped at 2000 entries; results are read by budget and page size.
- Cells preview only the first 512 characters and cap at 1 MiB each; the result budget defaults to 8 MB and the page size to 500 rows. Use “Fetch more” or full export for larger ranges.
Known boundaries:
- Indentation and clause wrapping for complex CTEs/subqueries are not finished yet (conservative
formatting works; see
Roadmap.md). - Result sorting is single-column and there is no global quick filter.
- ClickHouse is read-only; rqlite does not offer result editing, ANALYZE rerun or interactive transactions.
- Result editing requires a single table with a primary key; JOINs, views and aliased expression columns are read-only.
- SSH tunnels, cloud sync, multiple windows, GUI table designers, ER diagrams, visual query builders and a
manual transaction editor are explicitly out of the current plan (see
Roadmap.md).