I baselined six representative queries against both systems, then investigated a real regression rather than looking away from it: SQL Server ran one join nearly 2× slower than PostgreSQL. Four different tuning attempts all confirmed the same honest conclusion.
I picked six queries covering different real-world access patterns — point lookup, filtered join, group-by aggregation, join with aggregation, filtered range scan, and a heavy join+aggregation+sort — and baselined every one against both PostgreSQL and SQL Server.
| Query | Pattern | PostgreSQL | SQL Server | Result |
|---|---|---|---|---|
| Q1 | Point lookup | 13.2 ms | 50 ms | PostgreSQL faster |
| Q2 | Join + filter | 1,969.7 ms | 3,582 ms | Investigated below |
| Q3 | Group-by aggregation | 162.2 ms | 109 ms | 33% faster |
| Q4 | Join + group-by | 1,515.0 ms | 967 ms | 36% faster |
| Q5 | Filtered range scan | 467.3 ms | 316 ms | 32% faster |
| Q6 | Heavy join + sort | 6,096.4 ms | 2,051 ms | 66% faster |
Q2 — filtering providers by state and joining to their services — was SQL Server's one real regression. I treated it as a genuine tuning problem, not noise, and tried four different fixes in order.
provider_services has no state_abbr column of its own, so matching any single state means touching a large, scattered fraction of a 9.66-million-row table clustered by id, not by provider. I documented this as a genuine finding rather than forcing an artificial fix.