Efficiently Searching Schema in SQL Server Ed Pollack Database Administrator CommerceHub
Agenda Using Simple Tools to Build a Search Solution: Introduction. Why Do We Care? System Views (server). System Views (database). Putting Them All Together. Questions!? Conclusion.
Introduction SQL Server provides internal views that provide extensive information about your databases and server. These views are included in all SQL Server versions. System views tell us about EVERYTHING…such as Tables and columns Database properties Server specifications SQL Server services & features Lots and lots more…
Why Do We Care? Review dependencies for software releases. Code review scripts that alter/remove existing schema. Database or object migrations. Verifying use or non-use of an object. Database research and documentation. Database metrics. Curious DBAs!
System Views (Server) Server-level views reside in MSDB or Master and provide insight into server settings and features. Most SQL Server features have views that can tell you about their configuration, metadata, and relationships. These views can be joined together for greater insight. Many internals can be searched, such as replication, query plan cache, buffer cache, etc…
System Views (Server) Demo
System Views (Database) Database-level views reside with each database on a SQL Server. Provides details on database objects, such as schemas, tables, columns, and views. Can be joined to server views for a more complete view. Use this information to search for & analyze a database.
System Views (Database) Demo
Putting it All Together System views can be searched to determine if objects exist with certain names or attributes. Search can be customized as per server configuration. Results can be combined into a single data set. Encapsulate search logic in a stored procedure for convenience & reuse. Performance varies based on the number of databases and objects on a given SQL Server.
Putting it All Together Demo
Conclusion System views provide valuable insight into SQL Server. Simple tools can be combined to produce powerful solutions. Views exist for many features and are well documented. Replication, Resource Governor, IMOLTP, Partitioning, Compression, AlwaysOn, SSRS, SSIS, etc… Customize! Build a solution to meet your business needs.
Questions???
Contact Info & Links Ed Pollack ed7@alum.rpi.edu @EdwardPollack SQL Shack SQL Server Central SQL Saturday Albany (2016) Thank you!!!