Files
rengine/shared/services/planner_stats.py
T
Yogesh OjhaandClaude Fable 5.1 d4072b8efa perf: make the read path scale with the estate
Scan page froze on a duplicate each key; every tab body now sits in a
svelte:boundary. Composite discovered_at indexes on the five result
tables, leads counted in one FILTER pass, dashboard and scan-service
first-seen counts bounded to the scans in the window, ANALYZE at
finalize, shm_size on the db service, SQL_ECHO instead of DEBUG, an
entrypoint that serves with workers outside reload.

Settled-scope aggregates and search pages are cached by target
revision; triage, dismissal, interest evaluation, notes, certificate
rechecks and re-ranking bump it. Requests per page cut: single-flight
GETs, one schemas endpoint, batched whois correlations, a counts
endpoint for the dashboard, deduped store loads, trimmed coverage
payloads.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NWRq8utu7KXsVBVU3gYNi7
2026-09-12 08:49:41 +05:30

37 lines
910 B
Python

"""ANALYZE on the result tables."""
from __future__ import annotations
from sqlalchemy import text
from sqlalchemy.orm import Session
from shared.models.endpoint import Endpoint
from shared.models.http_asset import HttpAsset
from shared.models.interest import InterestSignal
from shared.models.ip_address import IpAddress
from shared.models.port import Port
from shared.models.subdomain import Subdomain
from shared.models.vulnerability import Vulnerability
RESULT_TABLES: tuple[str, ...] = tuple(
model.__tablename__
for model in (
Subdomain,
Endpoint,
Port,
IpAddress,
Vulnerability,
HttpAsset,
InterestSignal,
)
)
def analyze_result_tables(session: Session) -> None:
try:
session.execute(text(f"ANALYZE {', '.join(RESULT_TABLES)}"))
session.commit()
except Exception:
session.rollback()
raise