A monolithic query creates operational risk because every new condition adds row level processing, joins, and aggregation to one block of logic. That increases runtime, complicates troubleshooting, and makes changes more error prone. In practice, the issue is not just performance. It is also maintainability, because complex alert logic becomes harder to reason about and easier to break during updates.
Why a Monolithic View Becomes a Control Risk
A single SQL view can be manageable when it supports one detection pattern, but it starts to behave like shared infrastructure once alerting logic expands across multiple detections and data sources. At that point, one change can affect unrelated alerts, and the blast radius is no longer limited to a single use case. The query becomes part of the control plane for detection quality, not just a reporting convenience.
That matters because alert logic is rarely static. New sources introduce different schemas, different join paths, and different assumptions about timeliness or null handling. The risk is not only slower execution, but also silent logic drift, where a change intended for one detection weakens another without being obvious in review.
In practice, teams usually discover that problem only after a tuning change, a schema update, or a missed alert forces them to untangle logic that should never have been combined.
How the Failure Shows Up in Practice
The operational failure mode is usually cumulative. A view begins with a few conditions, then grows as analysts add more detections, more source tables, and more exception handling. Each addition increases the number of joins, filters, aggregations, and edge cases that must all be correct at once. Even when the SQL still runs, the semantic complexity rises faster than the line count suggests.
That creates three practical problems. First, performance becomes harder to predict because one new clause can change the planner’s choices for the entire view. Second, troubleshooting becomes slower because you cannot isolate whether a false positive or missing alert came from one detection, one source, or an interaction between them. Third, maintenance becomes risky because the person editing the view has to understand every downstream consumer before changing a single condition.
- Separate logic when detections have different refresh rates or data freshness assumptions.
- Split when one source requires heavy joins that do not apply to the other detections.
- Refactor when reviewers cannot explain the view’s behavior without tracing several nested branches.
- Test each detection path independently so regression is visible before deployment.
The control breaks down fastest in environments where alert logic is shared across teams but the source data is owned by different pipelines, because schema drift and ownership gaps make the view hard to validate end to end.
Common Variations and Edge Cases
Tighter centralisation often reduces duplication, but it also raises coordination overhead, so teams have to balance reuse against the cost of coupling unrelated detections together. The best design is not always “one view per alert,” but it should avoid forcing all alert logic into one place when the logic has different lifecycles or failure modes.
Material exceptions usually appear in one of three cases. A small shared view can be acceptable when the same base dataset supports closely related detections with similar timing and filtering rules. A layered design is better when a stable core view feeds smaller purpose-built views for each detection family. Full separation is usually warranted when one source is noisy, expensive to query, or governed by a different refresh or access model.
When teams keep a monolith, they often optimize for convenience and lose reviewability. The result is that changes become harder to approve because no one can confidently say which alert paths were affected. If the logic cannot be explained quickly to another analyst, it is already too coupled for reliable operations.
Risk and Threat Considerations
As alerting logic expands, the main risk is not just slower execution, it is control failure through coupling. A single shared query can become a point where one bad edit, one schema change, or one bad assumption affects multiple detections at once.
Failure mechanism: The query combines multiple conditions and data sources into one dependency chain, so a join change, filter change, or null-handling mistake can suppress alerts, inflate noise, or hide source-specific failures behind seemingly valid output.
Impact: Detection quality degrades across several use cases at once, root-cause analysis takes longer, and the team may miss real activity because the failure is buried inside a seemingly successful view.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
MITRE ATT&CK address the attack and risk surface, while CIS Controls v8 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| CIS Controls v8 | 8.3 — Data Recovery | Resilient detection logic needs recoverable, testable query components. |
| Recommendation — Separate shared query logic so one faulty change does not disrupt multiple detections. | ||
| NIST CSF 2.0 | DE.CM — Continuous Monitoring | Alert views directly support monitoring quality and signal integrity. |
| PR.IP — Information Protection Processes and Procedures | Complex alert logic needs maintainable, repeatable operational procedures. | |
| Recommendation — Monitor detection pipelines for regressions that alter alert fidelity. Document and version detection logic to reduce breakage during updates. | ||
| MITRE ATT&CK | T1059 — Command and Scripting Interpreter | SQL-based detection logic is an executable analysis surface that can fail operationally. |
| Recommendation — Treat complex query logic as code and test changes before deployment. | ||
Practitioner Guidance
What to prioritise: Split the design at the point where detections stop sharing the same data shape, timing assumptions, and review owner. That is usually the clearest sign that a shared view has turned into an accidental dependency hub.
What to verify: Validate each alert path independently, including row counts, join cardinality, and output stability after schema or filter changes. If you cannot explain the expected output for each detection in isolation, the view is too coupled to trust.
Practitioner takeaway: Shared SQL is fine for shared logic, but once one view becomes the place where many detections are assembled, the safer design is to preserve reuse in the data layer while keeping alert-specific logic separable and testable.
Related resources from NHI Mgmt Group
- Why does data normalisation become so expensive across multiple security platforms?
- Why do data inventories become essential when organisations manage personal and sensitive data across multiple systems?
- Why do user-scoped credentials become risky once a tool outgrows a single person?
- How should organisations govern access to business data across multiple sources and user groups?