DEV Community

Cover image for Cutting database metadata load times by 80% and adding interactive ER diagrams
Ehitel Rodriguez
Ehitel Rodriguez

Posted on

Cutting database metadata load times by 80% and adding interactive ER diagrams

When working with relational databases, slow metadata fetching and lacking visual schema tools quickly become friction points in daily workflows.

In the latest update of EZQL, I focused on solving two main problems: eliminating connection bottlenecks when inspecting database schemas and introducing an interactive diagram tool.

Parallel Metadata Engine in Go

Expanding a database in an object explorer requires querying multiple system catalog views: tables, views, stored procedures, functions, triggers, users, and roles.

Doing this sequentially over a single connection took around 2.0 seconds on moderate schemas. To fix this, I reworked the backend service in Go:

  • Queries for all 7 object categories now run concurrently across the connection pool using sync.WaitGroup and goroutines.
  • Response time dropped from ~2.0s down to ~200ms (>80% reduction).
  • Added a 150ms debounced prefetching mechanism for column metadata to keep IntelliSense responsive in the editor.

Interactive Entity-Relationship Diagrams (ERD)

Reviewing foreign key structures directly from table trees can be tedious, so I added a dedicated visual diagram canvas:

  • Draggable table cards connected by dynamic Bezier curves based on foreign key relationships.
  • State persistence using localStorage, keeping node positions intact across sessions.
  • Export options for SVG, PNG, and clipboard copy.

Trigger Management and Object Tree Cleanup

  • Direct status detection for table triggers using sys.triggers (is_disabled).
  • Context menu options to enable, disable, alter, or drop triggers without manually writing the DDL statements.
  • Visual distinction between Primary Keys, Foreign Keys, and column data types.

If you work with SQL Server on macOS, Linux, or Windows, you can test these additions directly on ezql.app.

Do you usually rely on visual diagrams when working with existing schemas, or do you prefer inspecting constraints via queries?

Top comments (0)