Performance
Connection pooling
Section titled “Connection pooling”MCP-Go-MSSQL uses the built-in connection pool from the go-mssqldb driver. Connections are automatically reused.
Pool configuration
Section titled “Pool configuration”The pool is configured with limits to prevent resource exhaustion:
- Maximum open connections: Limited to avoid saturating the SQL Server
- Idle connections: Kept open for quick reuse
- Timeouts: Connections exceeding the timeout are automatically closed
Prepared statements
Section titled “Prepared statements”All queries use PrepareContext(), which allows SQL Server to cache execution plans and improve performance on repeated queries.
Recommendations
Section titled “Recommendations”Efficient queries
Section titled “Efficient queries”- Use
SELECTwith specific columns instead ofSELECT * - Limit results with
TOPorOFFSET/FETCH - Leverage existing indexes in
WHEREclauses
Monitoring
Section titled “Monitoring”- Watch query response times in the logs
- Use
get_indexesto verify that tables have adequate indexes - Check
get_database_infofor general statistics
Timeouts
Section titled “Timeouts”Connection timeouts prevent queries from running indefinitely. If a legitimate query exceeds the timeout, consider optimizing it or increasing the limit.