Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

perf(catalog): ERD neighbourhood and MCP describe/sample read the whole schema catalog; filter tables in SQL

オープン
#1,572 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
dart, mysql, postgresql, sqlite

調査の方向性

Start with lib/core/erd/erd_catalog.dart:198-248 and lib/core/mcp/mcp_query_service.dart:245-270, then inspect the columnsSql and viewColumnsSql definitions for PostgreSQL, MySQL, and SQLite. Trace how ERD neighbourhood names and MCP table validation flow into those queries, and review the related tests. Done means SQL filters catalog reads to the requested tables, MCP uses a cheap existence check where appropriate, and a neighbourhood remains complete beyond the catalog row limit.

索引モデルが issue の本文から書いたものです。

説明

backend core P3 performance

Problem

Two paths read the whole schema catalog when they need a few tables:

  1. ERD neighbourhood (ErdCatalog.loadNeighbourhood, lib/core/erd/erd_catalog.dart:198-248). It loads all FKs (needed for the graph walk), then for every schema in the neighbourhood runs columnsSql for all columns of that schema and filters in Dart (if (names.contains(r[0])), :230/:238). The PostgreSQL columnsSql has per-column correlated subqueries (unique-index EXISTS, pg_enum string_agg, col_description, pg_get_expr), so the cost grows with the schema, not with the diagram. With catalogRowLimit = 200000 (:19) a large schema is truncated before filtering, so the focused table can lose its columns even though it needs only a few rows.
  2. MCP describe_table / sample_rows (McpQueryService._loadCatalog, lib/core/mcp/mcp_query_service.dart:245-270). To find one table it runs three catalog queries over the whole schema (columns, FKs, view columns) on every call. sample_rows uses the result only to validate the table name.

Fix

  • Add a table filter to columnsSql / viewColumnsSql: PostgreSQL c.relname = ANY($names) per schema, MySQL table_name IN (...), SQLite m.name IN (...) (literal-escaped as in _lit, or bind parameters where the delegate supports them).
  • ERD neighbourhood: walk FKs first, then fetch columns only for the resulting names.
  • MCP: validate the name with a cheap existence query (to_regclass / information_schema.tables / sqlite_master), and describe one table with the filtered column/FK queries. Keep the full catalog only for list_tables and the schema:// resource.
  • Tests: the generated SQL contains the filter; the neighbourhood of a table in a schema larger than the row limit is complete.

Related: ERD epic #1166 and #1167 (same catalog SQL).

主要言語
Dart
スター
23
フォーク
1
平均マージ
31分
マージ済み PR(30日)
570

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

QueryaHub/Querya-Desktop のほかの issue

QueryaHub/Querya-Desktop の issue をすべて見る

似ている issue

Dart の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。