Paste any SQL query. Instantly get a performance score, a list of anti-patterns with explanations, and an optimized rewrite — no server, no signup.
Write or paste a SQL query on the left,
then click Analyze to see results.
The demo above runs the analysis engine ported to JavaScript. The original is a Python package with a command-line tool. Same rules, same scoring: the JS version mirrors it exactly.
@dataclass class AnalysisReport: query: str issues: List[Issue] = field(default_factory=list) score: int = 100 PENALTIES = {"HIGH": 25, "MEDIUM": 10, "LOW": 5} @property def grade(self) -> str: if self.score >= 90: return "A" if self.score >= 75: return "B" if self.score >= 60: return "C" if self.score >= 40: return "D" return "F" class SQLAnalyzer: def _rule_leading_wildcard(self, norm, raw): if re.search(r"LIKE\s+'%\w", norm): return Issue( severity="HIGH", code="LEADING_WILDCARD", description="LIKE '%...' disables B-tree index, forces full table scan.", suggestion="Use GIN full-text index or restructure to trailing: LIKE 'term%'." ) def analyze(self, query: str) -> AnalysisReport: report = AnalysisReport(query=query) norm = re.sub(r"\s+", " ", query.strip().upper()) for rule in self._all_rules(): issue = rule(norm, query) if issue: report.add(issue) return report