Skip to content

[P1][perf] fetchSnapshot issues N+1 IPC calls per table — slow on large schemas #373

Closed

Description

@EVWorth

Context

Schema Compare snapshot fetch over many tables.

Problem

src/components/compare/SchemaCompare.tsx:97-114 issues api.getColumns + api.getIndexes separately per table per side — 2 IPC round-trips per table per side. With 200 tables per side, that's 800 IPC calls. ARCHITECTURE §8 performance budget forbids N+1; this is the textbook violation. The schema inspector has get_table_ddl (commands/mod.rs:279) that returns the full DDL in one call.

Files

  • src/components/compare/SchemaCompare.tsx:97-114

Repro

Compare two databases with 200 tables each. The Compare button takes 8+ seconds to complete.

Expected

Compare completes in < 1s wall-time.

Proposed fix

Add a get_table_full_metadata(connection_id, database, table) -> TableFullMetadata { columns, indexes, foreign_keys, options, comment } Tauri command in mas-core/src/schema/inspector.rs. Frontend calls it once per table. Scope: M.

Acceptance

A schema with 100 tables fetches in < 1s wall-time (from 4s+). Backend test asserts the new command returns the same data as 3 separate calls (columns + indexes + FKs).

Needs human verify

yes

Doc drift

no

Activity

  1. added
    audit
    severity/p1
    kind/perf
    area/compare
    on Jul 31, 2026
  2. EVWorth commented on Sep 9, 2026

    @EVWorth
    OwnerAuthor

    Closed by removing the feature.

    Schema compare could not back the claim it made — foreign keys were absent from the snapshot entirely, DDL was compared after lowercasing and collapsing whitespace, and column order was ignored — while the sync half could leave a target half-migrated. A compare tool that is quietly wrong is worse than none, because people act on its answer.

    Fixing that properly is a real piece of work, most of it a genuine DDL comparison rather than string normalisation, and the feature is not part of how this project is used. Removed rather than carried: the history has it if someone wants it back.

    Removed in the PR closing this issue: SchemaCompare, SyncPreview, schema-diff, sync-sql-generator, their tests, the compare editor tab type, and the menu, title-bar and toolbar entry points.

  3. added a commit that references this issue on Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/compareauditkind/perfseverity/p1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions