mirror of
https://github.com/BaaRai/ARTEX.git
synced 2026-11-15 04:30:55 +08:00
BuildCoverageGraph issued one QueryRow per connector root domain and one per company: 221 statements for a task scoped by 800 subdomains over 200 roots and 20 companies. Fetch them with one ANY() query each. The coverage target join probes task_scope once per asset, and the icp branch fell back to uq_task_scope_v2 with only kind as index condition; migration 0003 adds a partial index on task_scope(value) for icp rows. Large-fixture invariants test and benchmark included.
10 lines
687 B
SQL
10 lines
687 B
SQL
-- The coverage target CTE (contextCoverageCTE / covTargetCTE / scopeTargetCTE)
|
|
-- joins assets to task_scope on an OR of per-kind predicates. PostgreSQL plans it
|
|
-- as one BitmapOr probe of task_scope per asset. Every branch had an index except
|
|
-- kind='icp', which fell back to uq_task_scope_v2 with only "kind = 'icp'" as the
|
|
-- index condition (task_id is the leading column), so each probe walked the
|
|
-- whole unique index: about 70% of the buffer hits of the coverage-graph query on
|
|
-- a 3,000-asset task scoped by 800 subdomains. This partial index makes the icp
|
|
-- probe an equality lookup on value.
|
|
CREATE INDEX IF NOT EXISTS idx_ts_icp ON task_scope(value) WHERE kind = 'icp';
|