<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: riii111</title>
    <description>The latest articles on DEV Community by riii111 (@riii111_8782a7e607d04c8e8).</description>
    <link>https://dev.to/riii111_8782a7e607d04c8e8</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3806061%2Fc5c32494-8508-4120-93dd-c0aed2225751.jpg</url>
      <title>DEV Community: riii111</title>
      <link>https://dev.to/riii111_8782a7e607d04c8e8</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/riii111_8782a7e607d04c8e8"/>
    <language>en</language>
    <item>
      <title>I built a fast, driver-less TUI for browsing PostgreSQL, with ER diagrams</title>
      <dc:creator>riii111</dc:creator>
      <pubDate>Thu, 05 Mar 2026 14:05:11 +0000</pubDate>
      <link>https://dev.to/riii111_8782a7e607d04c8e8/i-built-a-fast-driver-less-tui-for-browsing-postgresql-with-er-diagrams-50k9</link>
      <guid>https://dev.to/riii111_8782a7e607d04c8e8/i-built-a-fast-driver-less-tui-for-browsing-postgresql-with-er-diagrams-50k9</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fucg8ahfgsta4cixclo5o.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fucg8ahfgsta4cixclo5o.gif" alt="hero"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you live in the terminal and work with PostgreSQL daily, this is for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I built this
&lt;/h2&gt;

&lt;p&gt;I've been bouncing between DBeaver, DataGrip, and various CLI tools for years. None of them hit the sweet spot I was looking for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Zero-setup.&lt;/strong&gt; I didn't want to install database drivers or configure connection pools. If you have &lt;code&gt;psql&lt;/code&gt;, you should be good to go.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Minimal, vim-like UX.&lt;/strong&gt; I wanted something like &lt;a href="https://github.com/stevearc/oil.nvim" rel="noopener noreferrer"&gt;oil.nvim&lt;/a&gt; for databases. Something that appears when you need it and disappears when you don't. No permanent sidebar eating your screen real estate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ER diagrams in the terminal.&lt;/strong&gt; DBeaver and DataGrip can do this, but no TUI tool could. I wanted to stay in my terminal.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So I built &lt;strong&gt;sabiql&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;

&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/riii111" rel="noopener noreferrer"&gt;
        riii111
      &lt;/a&gt; / &lt;a href="https://github.com/riii111/sabiql" rel="noopener noreferrer"&gt;
        sabiql
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A fast, driver-less TUI to browse, query, and edit PostgreSQL databases
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;sabiql&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://private-user-images.githubusercontent.com/131587765/558534605-79b6a108-be29-40ab-89d1-f9dec7a28e8d.jpg?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzQ2NDMzOTUsIm5iZiI6MTc3NDY0MzA5NSwicGF0aCI6Ii8xMzE1ODc3NjUvNTU4NTM0NjA1LTc5YjZhMTA4LWJlMjktNDBhYi04OWQxLWY5ZGVjN2EyOGU4ZC5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwMzI3JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDMyN1QyMDI0NTVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kOGQyNzVkZGRjNDBiYmQ1YTQ1YWEwZjdiYjRjYWM5YWY5ZmMxMDc5MzdlNTNiOGY0YmU3Y2Q1MTAzM2ZhZjllJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.40skDVxryAsn3aiT3W-qttX67t9zsp9IPgikgwxHRCk"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fprivate-user-images.githubusercontent.com%2F131587765%2F558534605-79b6a108-be29-40ab-89d1-f9dec7a28e8d.jpg%3Fjwt%3DeyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzQ2NDMzOTUsIm5iZiI6MTc3NDY0MzA5NSwicGF0aCI6Ii8xMzE1ODc3NjUvNTU4NTM0NjA1LTc5YjZhMTA4LWJlMjktNDBhYi04OWQxLWY5ZGVjN2EyOGU4ZC5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwMzI3JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDMyN1QyMDI0NTVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kOGQyNzVkZGRjNDBiYmQ1YTQ1YWEwZjdiYjRjYWM5YWY5ZmMxMDc5MzdlNTNiOGY0YmU3Y2Q1MTAzM2ZhZjllJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.40skDVxryAsn3aiT3W-qttX67t9zsp9IPgikgwxHRCk" alt="hero"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A fast, driver-less TUI to browse, query, and edit PostgreSQL databases — no drivers, no setup, just &lt;code&gt;psql&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/riii111/sabiql/actions/workflows/ci.yml" rel="noopener noreferrer"&gt;&lt;img src="https://github.com/riii111/sabiql/actions/workflows/ci.yml/badge.svg" alt="CI"&gt;&lt;/a&gt;
&lt;a href="https://opensource.org/licenses/MIT" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667" alt="License: MIT"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Concept&lt;/h2&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;Vim-first · Safe by design · Oil-and-vinegar UI · Fast and lightweight&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;sabiql wraps your existing &lt;code&gt;psql&lt;/code&gt; CLI. No Rust database drivers, no connection pools, no extra dependencies. Point it at your database and get a full-featured TUI. Your &lt;code&gt;psql&lt;/code&gt; config, &lt;code&gt;.pgpass&lt;/code&gt;, SSL setup all just work.&lt;/p&gt;
&lt;p&gt;Inspired by &lt;a href="https://github.com/stevearc/oil.nvim" rel="noopener noreferrer"&gt;oil.nvim&lt;/a&gt;'s "oil and vinegar" philosophy: UI elements appear only when needed, never occupying your screen permanently. Vim-native keybindings (&lt;code&gt;j/k&lt;/code&gt;, &lt;code&gt;dd&lt;/code&gt;, &lt;code&gt;/&lt;/code&gt;) let you navigate and edit without leaving your muscle memory.&lt;/p&gt;
&lt;p&gt;Destructive operations are guarded. Inline edits and row deletions always show a preview modal before touching your data. Read-only mode (&lt;code&gt;Ctrl+R&lt;/code&gt;) goes further — block all writes at the PostgreSQL session level with a single keystroke.&lt;/p&gt;
&lt;p&gt;Built in Rust for minimal…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/riii111/sabiql" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;




&lt;p&gt;After releasing it, &lt;a href="https://github.com/orhun" rel="noopener noreferrer"&gt;orhun&lt;/a&gt; (a Ratatui maintainer) gave it a &lt;a href="https://x.com/orhundev/status/2026282241106616552" rel="noopener noreferrer"&gt;shout-out&lt;/a&gt;, it got listed on &lt;a href="https://github.com/ratatui/awesome-ratatui" rel="noopener noreferrer"&gt;awesome-ratatui&lt;/a&gt;, and &lt;a href="https://postgresweekly.com/issues/637" rel="noopener noreferrer"&gt;Postgres Weekly&lt;/a&gt; picked it up. Since then, I've been getting feature requests via issues and steadily shipping them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Design philosophy
&lt;/h2&gt;

&lt;p&gt;Drew Neil, the creator of vim-vinegar, once wrote:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Split windows and the project drawer go together like oil and vinegar. I don't mean to say that you can combine them to create a delicious salad dressing. I mean that they don't mix well!"&lt;br&gt;
— Drew Neil, &lt;a href="http://vimcasts.org/blog/2013/01/oil-and-vinegar-split-windows-and-project-drawer/" rel="noopener noreferrer"&gt;Oil and vinegar&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;oil.nvim inherited this idea, treating file operations as regular buffers instead of a persistent sidebar.&lt;/p&gt;

&lt;p&gt;sabiql takes a similar approach for databases. SQL modals, ER diagrams, and query results are independent overlays you summon and dismiss. When you need to dig deeper, toggle focus mode for a full-screen view. No mouse, no extra windows, just keyboard-driven context switches that stay out of your way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Features
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Connection Management
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6gbgkdr66s8oq8z60sot.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6gbgkdr66s8oq8z60sot.png" alt="Connection modal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enter your connection details on first launch. They're saved to &lt;code&gt;~/.config/sabiql/connections.toml&lt;/code&gt;, so you never have to type them again. Editing existing connections is supported too.&lt;/p&gt;

&lt;p&gt;I recently added &lt;code&gt;pg_service.conf&lt;/code&gt; support too, so you can reuse your existing service definitions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fum94cg9465azwymrwzad.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fum94cg9465azwymrwzad.png" alt="Error with yank"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Connection errors can be yanked to clipboard.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Inspector Pane (7 tabs of metadata)
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhbg23fjudxg8utptx1q0.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhbg23fjudxg8utptx1q0.gif" alt="Inspector demo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once connected, you get an Explorer (table list) and an Inspector pane with &lt;strong&gt;7 tabs&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tab&lt;/th&gt;
&lt;th&gt;What it shows&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Info&lt;/td&gt;
&lt;td&gt;Owner, comment, estimated row count, schema&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cols&lt;/td&gt;
&lt;td&gt;Column name, type, nullable, PK, default, comment&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Idx&lt;/td&gt;
&lt;td&gt;Index name, target columns, type (btree/hash/gin…), uniqueness&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;FK&lt;/td&gt;
&lt;td&gt;Foreign key name, referenced table, columns&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RLS&lt;/td&gt;
&lt;td&gt;RLS enabled/disabled, policy name, command, PERMISSIVE/RESTRICTIVE&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Trig&lt;/td&gt;
&lt;td&gt;Trigger name, timing, event, function name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DDL&lt;/td&gt;
&lt;td&gt;Auto-generated &lt;code&gt;CREATE TABLE&lt;/code&gt; statement (yankable)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This is especially useful for quick security checks. You can instantly see which tables have RLS, who owns them, and whether a given role might bypass policies.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Inline Edit &amp;amp; Row Deletion
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4v5ukjo1ebe20f332mu0.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4v5ukjo1ebe20f332mu0.gif" alt="Inline edit demo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Edit cells in-place. Before execution, you get a preview of the exact SQL that will run so you can verify the change.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpmv7ff433whnxn919r22.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpmv7ff433whnxn919r22.png" alt="change confirm"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are a couple of safety guards baked in. If there's no WHERE clause, execution is blocked so you don't accidentally mass-update. Same thing if the row can't be uniquely identified.&lt;/p&gt;

&lt;p&gt;You can also do vim-style &lt;code&gt;dd&lt;/code&gt; then &lt;code&gt;:w&lt;/code&gt; for row deletion, with a preview confirmation step.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. SQL Modal with Auto-Completion
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbupwn4sxoltv3uk3xcch.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbupwn4sxoltv3uk3xcch.gif" alt="SQL modal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Press &lt;code&gt;s&lt;/code&gt; to open the SQL modal. It auto-completes table names, column names, and SQL keywords right inside the TUI, so you don't need a separate tool for ad-hoc queries.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. ER Diagram Generation
&lt;/h3&gt;

&lt;p&gt;I haven't seen another TUI database tool that does this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnuarj6opopmwcdpj2nrr.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnuarj6opopmwcdpj2nrr.gif" alt="ER Diagram"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Press &lt;code&gt;e&lt;/code&gt; to generate an ER diagram and open it in your browser. You can also generate &lt;strong&gt;focused diagrams&lt;/strong&gt; for specific tables only.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Vim-like Navigation &amp;amp; Command Palette
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;j&lt;/code&gt;/&lt;code&gt;k&lt;/code&gt; for scrolling, &lt;code&gt;g&lt;/code&gt;/&lt;code&gt;G&lt;/code&gt; for jump to top/bottom&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;f&lt;/code&gt; for focus mode (expand any pane to full screen)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Ctrl+K&lt;/code&gt; for the command palette&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;?&lt;/code&gt; for the complete keybindings reference&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  7. Inherits Your Terminal Theme
&lt;/h3&gt;

&lt;p&gt;sabiql follows your terminal's color scheme, transparency included.&lt;/p&gt;

&lt;h2&gt;
  
  
  Under the hood
&lt;/h2&gt;

&lt;p&gt;The "no driver" approach means sabiql spawns &lt;code&gt;psql&lt;/code&gt; as a subprocess for every query, including user-issued SELECTs and INSERTs. This keeps dependencies minimal, but spawn costs add up fast when you're bulk-fetching metadata at startup.&lt;/p&gt;

&lt;p&gt;Here's what I did about it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prefetch optimization for auto-completion
&lt;/h3&gt;

&lt;p&gt;The auto-completion engine needs metadata for all tables. My first implementation ran 6 queries per table, so for a database with 538 tables, that's &lt;strong&gt;3,228 psql spawns&lt;/strong&gt; just to populate completions.&lt;/p&gt;

&lt;p&gt;I replaced that with a single lightweight query that fetches only the columns and foreign keys the completion engine actually uses, skipping indexes, RLS, and triggers entirely.&lt;/p&gt;

&lt;p&gt;Spawn count dropped to &lt;strong&gt;1/6&lt;/strong&gt;, and the CPU spike went from 3-5 seconds down to under 100ms (tested on a 538-table database).&lt;/p&gt;

&lt;h3&gt;
  
  
  Two-tier caching
&lt;/h3&gt;

&lt;p&gt;Explorer, SQL completion, and ER diagram generation all fetch metadata, so caching matters a lot on large databases. I split it into two tiers based on access patterns.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tier 1&lt;/strong&gt; is a TTL cache (5 min) for the table list and schema info. Explorer and SQL completion initialization hit this. The data rarely changes, so a time-based expiry works well.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tier 2&lt;/strong&gt; is an LRU cache for per-table column and FK details. SQL completion and ER diagram generation share this, so if completion already warmed up a table, ER diagram generation doesn't refetch it.&lt;/p&gt;

&lt;p&gt;One exception: ER generation intentionally bypasses Tier 1 and always fetches fresh data. I want ER diagrams to always reflect the current state. To keep this efficient, it checks MD5 signatures from &lt;code&gt;pg_catalog&lt;/code&gt; for change detection and only refreshes Tier 2 entries for tables that actually changed. So even right after an &lt;code&gt;ALTER TABLE&lt;/code&gt;, the diagram is accurate without a full refetch.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# macOS / Linux&lt;/span&gt;
brew &lt;span class="nb"&gt;install &lt;/span&gt;riii111/sabiql/sabiql

&lt;span class="c"&gt;# Cargo (crates.io)&lt;/span&gt;
cargo &lt;span class="nb"&gt;install &lt;/span&gt;sabiql

&lt;span class="c"&gt;# Arch Linux (AUR)&lt;/span&gt;
paru &lt;span class="nt"&gt;-S&lt;/span&gt; sabiql  &lt;span class="c"&gt;# or yay -S sabiql&lt;/span&gt;

&lt;span class="c"&gt;# FreeBSD (ports)&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; /usr/ports/databases/sabiql/ &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; make &lt;span class="nb"&gt;install &lt;/span&gt;clean

&lt;span class="c"&gt;# Install script&lt;/span&gt;
curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://raw.githubusercontent.com/riii111/sabiql/main/install.sh | sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Run &lt;code&gt;sabiql&lt;/code&gt;, enter your connection on first launch, and press &lt;code&gt;?&lt;/code&gt; for help.&lt;/p&gt;

&lt;p&gt;You'll need the &lt;code&gt;psql&lt;/code&gt; CLI (you probably already have it). Graphviz is optional, only needed for ER diagrams (&lt;code&gt;brew install graphviz&lt;/code&gt;).&lt;/p&gt;
&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;EXPLAIN&lt;/code&gt; analysis visualization&lt;/li&gt;
&lt;li&gt;CASCADE delete visualization&lt;/li&gt;
&lt;li&gt;Query history persistence&lt;/li&gt;
&lt;li&gt;Cloud SQL / AlloyDB connection support&lt;/li&gt;
&lt;li&gt;MySQL support (eventually)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Try it out
&lt;/h2&gt;

&lt;p&gt;I use sabiql daily and maintain it actively. If you're a terminal-first developer who works with PostgreSQL, give it a spin.&lt;/p&gt;

&lt;p&gt;Feedback, feature requests, and bug reports are very welcome on GitHub Issues.&lt;/p&gt;

&lt;p&gt;

&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/riii111" rel="noopener noreferrer"&gt;
        riii111
      &lt;/a&gt; / &lt;a href="https://github.com/riii111/sabiql" rel="noopener noreferrer"&gt;
        sabiql
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A fast, driver-less TUI to browse, query, and edit PostgreSQL databases
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;sabiql&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://private-user-images.githubusercontent.com/131587765/558534605-79b6a108-be29-40ab-89d1-f9dec7a28e8d.jpg?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzQ2NDMzOTUsIm5iZiI6MTc3NDY0MzA5NSwicGF0aCI6Ii8xMzE1ODc3NjUvNTU4NTM0NjA1LTc5YjZhMTA4LWJlMjktNDBhYi04OWQxLWY5ZGVjN2EyOGU4ZC5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwMzI3JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDMyN1QyMDI0NTVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kOGQyNzVkZGRjNDBiYmQ1YTQ1YWEwZjdiYjRjYWM5YWY5ZmMxMDc5MzdlNTNiOGY0YmU3Y2Q1MTAzM2ZhZjllJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.40skDVxryAsn3aiT3W-qttX67t9zsp9IPgikgwxHRCk"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fprivate-user-images.githubusercontent.com%2F131587765%2F558534605-79b6a108-be29-40ab-89d1-f9dec7a28e8d.jpg%3Fjwt%3DeyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzQ2NDMzOTUsIm5iZiI6MTc3NDY0MzA5NSwicGF0aCI6Ii8xMzE1ODc3NjUvNTU4NTM0NjA1LTc5YjZhMTA4LWJlMjktNDBhYi04OWQxLWY5ZGVjN2EyOGU4ZC5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwMzI3JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDMyN1QyMDI0NTVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kOGQyNzVkZGRjNDBiYmQ1YTQ1YWEwZjdiYjRjYWM5YWY5ZmMxMDc5MzdlNTNiOGY0YmU3Y2Q1MTAzM2ZhZjllJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.40skDVxryAsn3aiT3W-qttX67t9zsp9IPgikgwxHRCk" alt="hero"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A fast, driver-less TUI to browse, query, and edit PostgreSQL databases — no drivers, no setup, just &lt;code&gt;psql&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/riii111/sabiql/actions/workflows/ci.yml" rel="noopener noreferrer"&gt;&lt;img src="https://github.com/riii111/sabiql/actions/workflows/ci.yml/badge.svg" alt="CI"&gt;&lt;/a&gt;
&lt;a href="https://opensource.org/licenses/MIT" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667" alt="License: MIT"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Concept&lt;/h2&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;Vim-first · Safe by design · Oil-and-vinegar UI · Fast and lightweight&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;sabiql wraps your existing &lt;code&gt;psql&lt;/code&gt; CLI. No Rust database drivers, no connection pools, no extra dependencies. Point it at your database and get a full-featured TUI. Your &lt;code&gt;psql&lt;/code&gt; config, &lt;code&gt;.pgpass&lt;/code&gt;, SSL setup all just work.&lt;/p&gt;
&lt;p&gt;Inspired by &lt;a href="https://github.com/stevearc/oil.nvim" rel="noopener noreferrer"&gt;oil.nvim&lt;/a&gt;'s "oil and vinegar" philosophy: UI elements appear only when needed, never occupying your screen permanently. Vim-native keybindings (&lt;code&gt;j/k&lt;/code&gt;, &lt;code&gt;dd&lt;/code&gt;, &lt;code&gt;/&lt;/code&gt;) let you navigate and edit without leaving your muscle memory.&lt;/p&gt;
&lt;p&gt;Destructive operations are guarded. Inline edits and row deletions always show a preview modal before touching your data. Read-only mode (&lt;code&gt;Ctrl+R&lt;/code&gt;) goes further — block all writes at the PostgreSQL session level with a single keystroke.&lt;/p&gt;
&lt;p&gt;Built in Rust for minimal…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/riii111/sabiql" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;




&lt;p&gt;If you found this useful, a ⭐ on the repo would mean a lot!&lt;/p&gt;

</description>
      <category>rust</category>
      <category>postgres</category>
      <category>tui</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
