microsoft / microsoft/vscode-mssql

[Feature Request]: Query History — option to exclude specific queries from being captured

Open
#21,765 0 comments 0 reactions 1 assignee Claimed by @kburtram View on GitHub
Area - Query History Enhancement User-filed
Dominant language
TypeScript
Stars
1.9k
Forks
610
Avg merge
2d 3h
Merged PRs (30d)
97

Description

### Feature Description

Add a setting that lets users specify patterns to exclude from Query History capture.
Queries matching any pattern would not be saved to history.

Example setting:

"mssql.queryHistoryExcludePatterns": [
"sp_WhoIsActive",
"SELECT 1"
]

Behavior:
- Case-insensitive substring match by default
- If the executed query text contains any listed pattern, it is not saved to history
- No UI change needed — purely a settings.json configuration

### Problem and Motivation

Some queries are run repeatedly — dozens or even hundreds of times per session —
and are never something you'd want to retrieve from history. The most common
example for DBAs is sp_WhoIsActive, which I run 50–100 times in a single
monitoring session.

When this happens, Query History is completely flooded:

exec sp_WhoIsActive
exec sp_WhoIsActive
exec sp_WhoIsActive
... (×90 more)

Every actually useful query — the ones I'd want to recall — gets pushed out of
history entirely. The current settings (enableQueryHistoryCapture, queryHistoryLimit)
are all-or-nothing with no way to selectively suppress noisy queries.

### Related Area

- [ ] Connection dialog (SQL Server | Azure browse/Fabric browse)
- [x] Query editor
- [ ] Query results panel
- [ ] Object Explorer
- [ ] GitHub Copilot integration
- [ ] Preview/Edit data
- [ ] Table Designer
- [ ] Schema Designer
- [ ] Schema Compare
- [ ] Local SQL Server Container provisioning
- [ ] SQL database in Fabric provisioning
- [ ] DACPAC/BACPAC export/import
- [ ] SQL Database projects
- [ ] Query Plan Visualizer
- [ ] Other (please describe below)

### If you selected "Other", please describe the area

_No response_

### Confirmation

- [x] I have searched existing feature requests and couldn't find a match
- [ ] I want to help implement this feature

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.