QUERYGUARD

Detect. Optimize. Protect

Repo
QUERYGUARD banner

About

## The problem it solves

Modern production databases are the fragile backbone of every digital business. When application query patterns evolve or traffic spikes—such as during festive sales, product launches, or payroll cycles—unindexed or poorly written queries can instantly max out database CPU and trigger catastrophic service outages.

Traditionally, resolving these database bottlenecks traps engineering teams in a dangerous dilemma:

The Production Lock Hazard: Running a live CREATE INDEX on a massive table acquires table locks and consumes heavy disk write I/O, frequently causing the very database downtime engineers are trying to prevent. The Compliance & Privacy Blocker: Engineers cannot safely paste slow queries or execution plans into external AI tools (like ChatGPT or Claude) because production queries contain sensitive customer PII—names, passwords, phone numbers, and payment details. Doing so violates strict enterprise security frameworks like GDPR, HIPAA, and SOC-2. Manual Analysis Fatigue: Deciphering complex, multi-hundred-line EXPLAIN (ANALYZE) execution plan trees under the pressure of a 2:00 AM production outage takes hours of manual trial-and-error by senior Database Administrators (DBAs).

QueryGuard AI eliminates this dilemma by providing a self-driving, privacy-first database optimization copilot that automatically detects query bottlenecks, safely tests prospective fixes in virtual memory without disk locks, and enforces strict human-in-the-loop approval guardrails.

What People Can Use It For

Instant Root-Cause Diagnosis: Automatically inspects slow queries captured from pg_stat_statements and uses a Graph Neural Network (GraphSAGE) to classify the exact structural bottleneck—such as unindexed sequential scans, inefficient nested loops, or memory-spilling external sorts. Zero-Risk Virtual Index Testing: Simulates hypothetical compound B-Tree indexes directly inside PostgreSQL memory metadata via HypoPG. Users can test index ideas in less than 10 milliseconds with zero bytes of disk storage and zero table locks before touching live systems. Privacy-Safe Query Profiling: Sanitizes incoming queries using salted HMAC-SHA256 tokenization. All customer literals and sensitive identifiers are stripped and masked before analysis, allowing organizations to leverage AI tuning without exposing confidential data. Automated SQL & Partitioning Recommendations: Recommends optimal composite index column orderings (Equality → → Range → → Join keys), table partitioning strategies (e.g., monthly range partitioning), and query rewrites with evidence-backed before-and-after cost estimates. Role-Based Production Governance: Implements strict hierarchical separation of duties across Level 3 (Lead DBA), Level 2 (Senior Engineer), and Level 1 (Compliance Auditor), ensuring no changes hit production without authorized cryptographic audit trails. How It Makes Existing Tasks Easier and Safer From Hours of Firefighting to Seconds of Approval: Instead of spending hours reading raw query trees and guessing index configurations, teams receive an automated evidence packet proving the exact cost reduction (e.g., a 94% cost drop) and write-latency impact. Zero Disruption to Live Applications: By validating recommendations through in-memory simulation and generating non-blocking CREATE INDEX CONCURRENTLY scripts, database optimizations can be safely deployed during normal business hours without locking tables or interrupting active users. Built-in Compliance by Design: Security and compliance teams no longer need to restrict performance tuning. QueryGuard guarantees 0.00% raw data exposure by design, maintaining an immutable ledger of every inspection, simulation, and DBA sign-off. Eliminates Unnecessary Cloud Infrastructure Costs: Rather than prematurely scaling up expensive database hardware (e.g., moving to larger AWS RDS or Azure database tiers to absorb slow queries), engineering teams can surgically optimize their existing database clusters, saving thousands of dollars monthly in cloud overhead.

## Challenges we ran into

Challenges We Ran Into

AI Diagnostics Without Exposing Sensitive Data (Zero-PII)

Hurdle: Machine learning models typically analyze raw SQL text, which frequently contains customer PII (credit cards, names, credentials) and violates GDPR/HIPAA. Solution: We decoupled query syntax from plan topology. An AST parser and salted HMAC-SHA256 tokenizer mask all literals before AI ingestion, mapping PostgreSQL JSON EXPLAIN trees into node feature tensors for GraphSAGE GNN message passing.

Simulating Real Fixes Without Table Locks or Disk Bloat

Hurdle: Testing composite index recommendations in a live database normally runs CREATE INDEX, which locks production tables, consumes gigabytes of I/O, and risks service downtime. Solution: We integrated PostgreSQL’s HypoPG extension inside ephemeral transactions. The optimization agent simulates candidate B-Tree index structures strictly in virtual memory, verifying exact planner cost drops in <10ms with 0 bytes of physical disk usage and zero table locks.

High-Throughput GNN Inference Latency

Hurdle: Running real-time graph neural network inference synchronously on continuous query streams caused API response spikes on the backend. Solution: We implemented asynchronous vectorized batching for incoming execution plans, evaluating 64 graph structures concurrently while maintaining sub-second UI updates on the monitoring dashboard.

Team

From the public Devfolio project page. Votes, swipes and the judge score are hackfeed's own.

AI judge

Not judged yet. A free model reads this page, compares it with similar projects and this event's winners, then scores it and says what would make it win.

Still being built?

Not checked yet.

Swipe stats

0upvotes
0skips
0saves

Discussion 0

No comments yet. Ask the team something, or say what you'd use it for.

Posting as a guest. Plain text, 1,000 characters max.

Already built nearby

Closest projects by meaning and shared words. Similar isn't the same as copied: read them.