Hot answers tagged

7

select id from table where field in (gigantic list of ordered longs) Queries with long IN lists are slow, as they are parsed and compiled each call. Either pass the list as a JSON array: select id from table where field in (select value from openjson(@values)) Or use a Table-Valued Parameter or bulk load a temp table with the values. Ensure there is an ...


1

if only date: select convert(date, substring('202104171830',1,8))


1

A "query" one or more "plans", linked by sys.query_store_plan. Each "plan" has multiple rows in sys.query_store_runtime_stats. If you turn on Profiler while running the built-in Query Store reports you can see lots of examples. EG exec sp_executesql N'SELECT TOP (@results_row_count) p.query_id query_id, q.object_id ...


Only top voted, non community-wiki answers of a minimum length are eligible