All fields

“Query Optimization & Plans” in Information Technology

119 questions across 1 technology.

Information Technology

119 questions in 1 technology

#QuestionTechnologyTopicLevel
1What is an execution plan in SQL Server, and how does it help you understand query performance? SQL Server › Query Optimization & PlansSQL ServerQuery Optimization & PlansBeginner
2How do outdated or missing statistics affect the query optimizer's ability to choose an efficient execution plan? SQL Server › Query Optimization & PlansSQL ServerQuery Optimization & PlansIntermediate
3What is parameter sniffing, and how can it sometimes lead to unexpectedly poor query performance? SQL Server › Query Optimization & PlansSQL ServerQuery Optimization & PlansIntermediate
4How do you use the SQL Server Query Store feature to identify and address query performance regressions over time? SQL Server › Query Optimization & PlansSQL ServerQuery Optimization & PlansAdvanced
5What are the most common causes of poor query performance that you should check first when troubleshooting a slow query? SQL Server › Query Optimization & PlansSQL ServerQuery Optimization & PlansIntermediate
6How would you use query hints to influence the optimizer's behavior when you have determined the default execution plan is genuinely suboptimal? SQL Server › Query Optimization & PlansSQL ServerQuery Optimization & PlansAdvanced
7What is the difference between a table scan and an index seek in an execution plan, and why does this distinction matter for performance? SQL Server › Query Optimization & PlansSQL ServerQuery Optimization & PlansBeginner
8What is Query Store in SQL Server, and what information does it automatically capture? SQL Server › Query StoreSQL ServerQuery StoreBeginner
9How do you view the top resource consuming queries captured by Query Store? SQL Server › Query StoreSQL ServerQuery StoreBeginner
10How do you use Query Store to identify a query whose performance has regressed after a recent code deployment? SQL Server › Query StoreSQL ServerQuery StoreIntermediate
11How do you force SQL Server to use a specific, previously known good execution plan for a query using Query Store? SQL Server › Query StoreSQL ServerQuery StoreIntermediate
12How do you convert the results of a SQL query directly into an XML formatted document using the FOR XML clause? SQL Server › XML Data Type & QueryingSQL ServerXML Data Type & QueryingIntermediate
13How can Query Store data be queried directly using its underlying system views for custom analysis beyond the built-in reports? SQL Server › Query StoreSQL ServerQuery StoreAdvanced
14How does an XML index improve query performance against large or frequently queried XML columns? SQL Server › XML Data Type & QueryingSQL ServerXML Data Type & QueryingAdvanced
15How do statistics and query optimization differ between temporary tables and table variables, and how does this affect performance for larger data sets? SQL Server › Temporary Tables & Table VariablesSQL ServerTemporary Tables & Table VariablesIntermediate
16How do you extract a value from an XML column using the value method? SQL Server › XML Data Type & QueryingSQL ServerXML Data Type & QueryingBeginner
17What is a common table expression, and why would you use one instead of a subquery? SQL Server › Common Table Expressions (CTEs)SQL ServerCommon Table Expressions (CTEs)Beginner
18How do you write a query that retrieves data from a table on a linked server? SQL Server › Linked ServersSQL ServerLinked ServersBeginner
19What is the difference between a correlated and a non correlated subquery? SQL Server › SubqueriesSQL ServerSubqueriesBeginner
20How do you filter the results of a grouped query based on an aggregated value, such as only showing customers who spent more than a certain amount? SQL Server › Aggregate Functions & GROUP BYSQL ServerAggregate Functions & GROUP BYIntermediate
21How do you correctly combine WHERE and HAVING in the same query to filter both individual rows and grouped results? SQL Server › Aggregate Functions & GROUP BYSQL ServerAggregate Functions & GROUP BYIntermediate
22How do you query the change data captured for a table to find out exactly what changed within a specific time range? SQL Server › Change Data Capture (CDC)SQL ServerChange Data Capture (CDC)Intermediate
23What performance issues commonly arise when querying data through a linked server, and how can you address them? SQL Server › Linked ServersSQL ServerLinked ServersIntermediate
24How does partition elimination improve query performance for a partitioned table? SQL Server › PartitioningSQL ServerPartitioningIntermediate
25Why can calling a scalar user defined function within a query against a large table cause significant performance problems? SQL Server › User Defined FunctionsSQL ServerUser Defined FunctionsIntermediate
26In what situations does SQL Server's query optimizer typically prefer a hash join over a nested loop join or a merge join? SQL Server › Hash Indexes & Hash Join OperationsSQL ServerHash Indexes & Hash Join OperationsIntermediate
27How do the ROLLUP and CUBE extensions to GROUP BY help you generate subtotal and grand total rows in a single query? SQL Server › Aggregate Functions & GROUP BYSQL ServerAggregate Functions & GROUP BYAdvanced
28How would you build a dynamic SQL statement inside a stored procedure that constructs a flexible search query based on several optional filter parameters? SQL Server › Dynamic SQLSQL ServerDynamic SQLAdvanced
29How do you rank and sort full text search results by their relevance to the search query? SQL Server › Full Text SearchSQL ServerFull Text SearchAdvanced
30How does SQL Server's query optimizer decide which physical join algorithm, such as nested loops, merge join, or hash join, to actually use for a given query? SQL Server › JoinsSQL ServerJoinsAdvanced
31How would you troubleshoot a linked server query that is running much slower than expected? SQL Server › Linked ServersSQL ServerLinked ServersAdvanced
32How does SQL Server compile and cache execution plans for stored procedures, and how does this affect performance compared to ad hoc queries? SQL Server › Stored Procedures & FunctionsSQL ServerStored Procedures & FunctionsAdvanced
33How would you rewrite a slow correlated subquery as an equivalent, potentially faster JOIN based query? SQL Server › SubqueriesSQL ServerSubqueriesAdvanced
34How does the SQL Server query optimizer typically handle and potentially transform a subquery internally when generating an execution plan? SQL Server › SubqueriesSQL ServerSubqueriesAdvanced
35How would you use window functions together to build a comprehensive sales analytics report showing running totals, rankings, and period over period comparisons all in a single query? SQL Server › Window FunctionsSQL ServerWindow FunctionsAdvanced
36What are aggregate functions in SQL Server, and what are the most common ones? SQL Server › Aggregate Functions & GROUP BYSQL ServerAggregate Functions & GROUP BYBeginner
37What is the difference between the primary replica and secondary replicas in an Always On Availability Group? SQL Server › Always On Availability GroupsSQL ServerAlways On Availability GroupsBeginner
38What is Change Data Capture in SQL Server, and what problem does it solve? SQL Server › Change Data Capture (CDC)SQL ServerChange Data Capture (CDC)Beginner
39What is a columnstore index in SQL Server, and how is it different from a regular index? SQL Server › Columnstore IndexesSQL ServerColumnstore IndexesBeginner
40What is the difference between a clustered columnstore index and a nonclustered columnstore index? SQL Server › Columnstore IndexesSQL ServerColumnstore IndexesBeginner
41What is a cursor in SQL Server, and why do most developers try to avoid using them? SQL Server › CursorsSQL ServerCursorsBeginner
42What is the difference between VARCHAR and NVARCHAR, and when should you choose one over the other? SQL Server › Data Types & Schema DesignSQL ServerData Types & Schema DesignBeginner
43What is an index in SQL Server, and how does it help speed up queries? SQL Server › IndexesSQL ServerIndexesBeginner
44What is the difference between a clustered index and a nonclustered index? SQL Server › IndexesSQL ServerIndexesBeginner
45What are the four standard transaction isolation levels in SQL Server, and what does isolation level actually control? SQL Server › Isolation & LockingSQL ServerIsolation & LockingBeginner
46What is a linked server in SQL Server, and why would you set one up? SQL Server › Linked ServersSQL ServerLinked ServersBeginner
47How do you create a basic SQL Server Agent job that runs a T-SQL script on a defined schedule? SQL Server › SQL Server Agent & Job SchedulingSQL ServerSQL Server Agent & Job SchedulingBeginner
48What is SQL Server Profiler, and what is it traditionally used for? SQL Server › SQL Server Profiler & Extended EventsSQL ServerSQL Server Profiler & Extended EventsBeginner
49What are Extended Events, and why are they generally recommended over SQL Server Profiler for modern monitoring needs? SQL Server › SQL Server Profiler & Extended EventsSQL ServerSQL Server Profiler & Extended EventsBeginner
50What is a stored procedure in SQL Server, and what are the main benefits of using one? SQL Server › Stored Procedures & FunctionsSQL ServerStored Procedures & FunctionsBeginner
51What is the difference between a scalar function and a table valued function in SQL Server? SQL Server › Stored Procedures & FunctionsSQL ServerStored Procedures & FunctionsBeginner
52What is the difference between an inline table valued function and a multi statement table valued function? SQL Server › User Defined FunctionsSQL ServerUser Defined FunctionsBeginner
53What is a hash join, and how does SQL Server use it to combine two tables? SQL Server › Hash Indexes & Hash Join OperationsSQL ServerHash Indexes & Hash Join OperationsBeginner
54What is an availability group listener, and why is it important for applications connecting to an Always On Availability Group? SQL Server › Always On Availability GroupsSQL ServerAlways On Availability GroupsIntermediate
55What kinds of workloads benefit the most from columnstore indexes, and which workloads should avoid them? SQL Server › Columnstore IndexesSQL ServerColumnstore IndexesIntermediate
56What tools or queries can you use to monitor the health and effectiveness of a columnstore index over time? SQL Server › Columnstore IndexesSQL ServerColumnstore IndexesIntermediate
57What are the main limitations of common table expressions that developers should be aware of? SQL Server › Common Table Expressions (CTEs)SQL ServerCommon Table Expressions (CTEs)Intermediate
58How do you temporarily disable a constraint to perform a bulk data load, and how do you safely re-enable it afterward? SQL Server › Constraints (Primary Key, Foreign Key, Check & Unique)SQL ServerConstraints (Primary Key, Foreign Key, Check & Unique)Intermediate
59What are the different cursor types available in SQL Server, such as static, dynamic, and forward only, and how do they differ? SQL Server › CursorsSQL ServerCursorsIntermediate
60What is the performance impact of using a cursor compared to a set based operation on a large table, and why does this difference occur? SQL Server › CursorsSQL ServerCursorsIntermediate
61What does the FAST_FORWARD cursor option do, and when should you use it? SQL Server › CursorsSQL ServerCursorsIntermediate
62What are the differences between DATETIME, DATETIME2, and DATE, and when would you choose each one? SQL Server › Data Types & Schema DesignSQL ServerData Types & Schema DesignIntermediate
63How do you safely use sp_executesql to execute dynamic SQL with parameters, avoiding the risks of simple string concatenation? SQL Server › Dynamic SQLSQL ServerDynamic SQLIntermediate
64What is the difference between the CONTAINS and FREETEXT predicates when performing a full text search? SQL Server › Full Text SearchSQL ServerFull Text SearchIntermediate
65How do you perform a proximity search using full text search, finding rows where two words appear near each other? SQL Server › Full Text SearchSQL ServerFull Text SearchIntermediate
66How often does a full text index need to be updated to reflect changes made to the underlying table's data? SQL Server › Full Text SearchSQL ServerFull Text SearchIntermediate
67What is a covering index, and how does it help avoid an expensive lookup operation? SQL Server › IndexesSQL ServerIndexesIntermediate
68How do you identify unused or duplicate indexes that might be safely removed to improve write performance? SQL Server › IndexesSQL ServerIndexesIntermediate
69How do you decide which columns to choose, and in what order, when creating a composite index covering multiple columns? SQL Server › IndexesSQL ServerIndexesIntermediate
70What are natively compiled stored procedures, and how do they work together with memory optimized tables? SQL Server › In-Memory OLTP (Memory-Optimized Tables)SQL ServerIn-Memory OLTP (Memory-Optimized Tables)Intermediate
71What are lock escalation and its potential impact on a busy system? SQL Server › Isolation & LockingSQL ServerIsolation & LockingIntermediate
72What is a FULL OUTER JOIN, and when would you use one instead of a LEFT or RIGHT JOIN? SQL Server › JoinsSQL ServerJoinsIntermediate
73How does a sliding window pattern work for automatically archiving old data using partitioning? SQL Server › PartitioningSQL ServerPartitioningIntermediate
74How do you determine which partition a specific row of data belongs to, and how can this help with troubleshooting? SQL Server › PartitioningSQL ServerPartitioningIntermediate
75How do you monitor the health and latency of a transactional replication setup to ensure subscribers are staying reasonably up to date? SQL Server › ReplicationSQL ServerReplicationIntermediate
76How does SQL Server's memory architecture work, particularly regarding the buffer pool and how it affects performance? SQL Server › SQL Server Architecture & EditionsSQL ServerSQL Server Architecture & EditionsIntermediate
77What is tempdb, and why is its configuration particularly important for overall SQL Server performance? SQL Server › SQL Server Architecture & EditionsSQL ServerSQL Server Architecture & EditionsIntermediate
78How do you create an Extended Events session to capture specific long running queries on a production server? SQL Server › SQL Server Profiler & Extended EventsSQL ServerSQL Server Profiler & Extended EventsIntermediate
79How do you analyze the data captured by an Extended Events session once it has been running for a period of time? SQL Server › SQL Server Profiler & Extended EventsSQL ServerSQL Server Profiler & Extended EventsIntermediate
80How do you properly stop and clean up an Extended Events session once it is no longer needed? SQL Server › SQL Server Profiler & Extended EventsSQL ServerSQL Server Profiler & Extended EventsIntermediate
81What are the main differences between a stored procedure and a function in terms of what each one can and cannot do? SQL Server › Stored Procedures & FunctionsSQL ServerStored Procedures & FunctionsIntermediate
82What are common mistakes developers make when writing subqueries that can lead to incorrect results or poor performance? SQL Server › SubqueriesSQL ServerSubqueriesIntermediate
83Can you create indexes on a temporary table, and how does this compare to indexing options available for table variables? SQL Server › Temporary Tables & Table VariablesSQL ServerTemporary Tables & Table VariablesIntermediate
84How do IF and WHILE control flow statements work in T-SQL, and what kinds of tasks are they typically used for? SQL Server › T-SQL Fundamentals & SyntaxSQL ServerT-SQL Fundamentals & SyntaxIntermediate
85What are the differences between the various string functions available in T-SQL, such as SUBSTRING, CONCAT, and TRIM? SQL Server › T-SQL Fundamentals & SyntaxSQL ServerT-SQL Fundamentals & SyntaxIntermediate
86What improvements did SQL Server 2019 introduce for scalar function performance through a feature called scalar UDF inlining? SQL Server › User Defined FunctionsSQL ServerUser Defined FunctionsIntermediate
87What is an indexed view, and how can it improve the performance of complex, frequently run queries? SQL Server › ViewsSQL ServerViewsIntermediate
88What is the difference between a deadlock and normal blocking, and how do you tell them apart when troubleshooting a slow application? SQL Server › DeadlocksSQL ServerDeadlocksIntermediate
89How does the BUCKET_COUNT setting affect the performance of a hash index on a memory optimized table? SQL Server › Hash Indexes & Hash Join OperationsSQL ServerHash Indexes & Hash Join OperationsIntermediate
90How would you calculate a running total or a percentage of total using aggregate functions combined with window functions? SQL Server › Aggregate Functions & GROUP BYSQL ServerAggregate Functions & GROUP BYAdvanced
91What are the performance and storage considerations to keep in mind before enabling Change Data Capture on a very high volume table? SQL Server › Change Data Capture (CDC)SQL ServerChange Data Capture (CDC)Advanced
92What are delta stores and rowgroups in the context of columnstore indexes, and how do they affect performance over time? SQL Server › Columnstore IndexesSQL ServerColumnstore IndexesAdvanced
93How would you rewrite a common cursor based row by row update into an equivalent, much faster set based UPDATE statement? SQL Server › CursorsSQL ServerCursorsAdvanced
94What factors should guide the decision to denormalize a schema for performance reasons, and what tradeoffs come with that decision? SQL Server › Data Types & Schema DesignSQL ServerData Types & Schema DesignAdvanced
95What are the performance tradeoffs of using dynamic SQL compared to static, precompiled SQL statements? SQL Server › Dynamic SQLSQL ServerDynamic SQLAdvanced
96How does index fragmentation happen over time, and how do you address it? SQL Server › IndexesSQL ServerIndexesAdvanced
97How do filtered indexes work, and what specific scenarios benefit most from using one? SQL Server › IndexesSQL ServerIndexesAdvanced
98How would you decide whether a specific table in your application is a good candidate for conversion to a memory optimized table? SQL Server › In-Memory OLTP (Memory-Optimized Tables)SQL ServerIn-Memory OLTP (Memory-Optimized Tables)Advanced
99How would you diagnose and resolve a blocking problem where many queries are waiting on a single long running transaction? SQL Server › Isolation & LockingSQL ServerIsolation & LockingAdvanced
100How does Read Committed Snapshot Isolation differ from regular Read Committed isolation, and what tradeoff does enabling it introduce? SQL Server › Isolation & LockingSQL ServerIsolation & LockingAdvanced
101How does a CROSS JOIN work, and what are some legitimate use cases for it despite the risk of accidentally creating a huge result set? SQL Server › JoinsSQL ServerJoinsAdvanced
102What are alternatives to linked servers for integrating data from multiple different database systems, and when might they be a better choice? SQL Server › Linked ServersSQL ServerLinked ServersAdvanced
103What performance considerations should you keep in mind when using MERGE against very large source and target tables? SQL Server › Merge Statement (Upsert)SQL ServerMerge Statement (Upsert)Advanced
104When would it make sense to intentionally denormalize a database design, and what specific tradeoffs come with that decision? SQL Server › NormalizationSQL ServerNormalizationAdvanced
105What performance considerations should you keep in mind when using PIVOT or UNPIVOT on very large datasets? SQL Server › Pivoting & Unpivoting DataSQL ServerPivoting & Unpivoting DataAdvanced
106How do you monitor and troubleshoot SQL Server Agent job performance and failures across an entire server with many scheduled jobs? SQL Server › SQL Server Agent & Job SchedulingSQL ServerSQL Server Agent & Job SchedulingAdvanced
107How would you plan a hardware and configuration strategy for a new SQL Server installation supporting a large, performance critical application? SQL Server › SQL Server Architecture & EditionsSQL ServerSQL Server Architecture & EditionsAdvanced
108What is the performance overhead comparison between SQL Server Profiler, server side traces, and Extended Events, and how should this inform monitoring decisions on a production system? SQL Server › SQL Server Profiler & Extended EventsSQL ServerSQL Server Profiler & Extended EventsAdvanced
109How do you implement row level security to restrict which specific rows a user can see within a shared table, beyond simply controlling access to entire tables or columns? SQL Server › SQL Server Security & PermissionsSQL ServerSQL Server Security & PermissionsAdvanced
110How would you decide between using a temporary table, a table variable, and a common table expression for a specific intermediate data processing need within a stored procedure? SQL Server › Temporary Tables & Table VariablesSQL ServerTemporary Tables & Table VariablesAdvanced
111How does tempdb contention affect the performance of applications that heavily rely on temporary tables, and what strategies help mitigate this? SQL Server › Temporary Tables & Table VariablesSQL ServerTemporary Tables & Table VariablesAdvanced
112What is the performance overhead of Transparent Data Encryption, and how does it compare across different SQL Server versions? SQL Server › Transparent Data EncryptionSQL ServerTransparent Data EncryptionAdvanced
113What are the performance implications of using triggers heavily on a busy, high transaction volume table? SQL Server › TriggersSQL ServerTriggersAdvanced
114How do nested and recursive triggers work in SQL Server, and what precautions should be taken to avoid unexpected behavior or infinite loops? SQL Server › TriggersSQL ServerTriggersAdvanced
115What are the tradeoffs between implementing complex reusable business logic as a user defined function versus building it directly into application code? SQL Server › User Defined FunctionsSQL ServerUser Defined FunctionsAdvanced
116What happens to the performance and correctness of a view if the underlying tables change significantly after the view was originally created? SQL Server › ViewsSQL ServerViewsAdvanced
117How does the ROWS versus RANGE frame specification within an OVER clause affect the result of a window function like a running total? SQL Server › Window FunctionsSQL ServerWindow FunctionsAdvanced
118How would you read a deadlock graph to identify the exact queries and resources that caused a specific deadlock? SQL Server › DeadlocksSQL ServerDeadlocksAdvanced
119What happens when a hash join does not have enough memory available to build its hash table entirely in memory, and how does this affect performance? SQL Server › Hash Indexes & Hash Join OperationsSQL ServerHash Indexes & Hash Join OperationsAdvanced