Query Store Fix in SQL Server 2017

There is a Query Store fix in the latest Cumulative Updates of SQL Server 2017, and if you are keeping current with the latest cumulative updates, there’s a script you need to run if you’ve installed CU2 at any point.

First, if you are still on CU2, you might want to consider upgrading to CU4 (released February 17, 2018).

Second, if you previously had CU2 installed (and are now on CU3 or CU4), you want to make sure that you’ve run the script included with CU3 and CU4 release notes.

The script removes plans from Query Store that were captured when running CU2.  If you want to know for certain whether your database is affected before you execute the script, you can run the following query against the databases with Query Store enabled:

/* execute against EACH database that has Query Store enabled */
SELECT COUNT([plan_id])
FROM [sys].[query_store_plan]
WHERE [engine_version] = '14.0.3008.27';

As an aside, if you aren’t using Query Store, notice that one of the things it captures for the plan is SQL Server version…how cool is that in terms of testing, upgrading, and troubleshooting?

If you have plans from CU2, they need to be removed from Query Store, and this is done in the script using the sys.sp_query_store_remove_plan function.  Understand that in addition to removing the query plan, it will also remove the runtime stats tied to that plan from Query Store.  But, more important than that, if that plan was forced for a query, it will be un-forced before it is removed.

Therefore, before you run the script from Microsoft, I strongly recommend you not just check to see if you have plans from CU2, but you also look to see if any of those are forced:

/* execute against EACH database that has Query Store enabled */
      WHEN [q].[object_id] = 0 THEN 'Ad-hoc'
      ELSE OBJECT_NAME([q].[object_id])
   END AS [Object],
   [q].*, TRY_CONVERT(XML, [p].[query_plan]) AS [QueryPlan_XML]
FROM [sys].[query_store_plan]  [p]
JOIN [sys].[query_store_query] [q]
   ON [p].[query_id] = [q].[query_id]
JOIN [sys].[query_store_query_text] [qt]
   ON [q].[query_text_id] = [qt].[query_text_id]
WHERE  [engine_version] = '14.0.3008.27'
   AND [p].[is_forced_plan] = 1;

This script will list any queries that have forced plans, and if they are part of an object (e.g. stored procedure) it will also list the object name.  If no rows return from this query, then you don’t have any forced plans which are affected and you can run the script from Microsoft.

If you do have any queries with forced plans, I recommend that you save a copy of the forced plan as a .sqlplan file, so that you have documentation of what plan was forced.  There are two ways to do this:

  1. Within the Query Store page for the user database in SSMS, run the Queries with Forced Plans report. In the grid, sort the list by query_id.  For each query_id identified by the query above, select the forced plan, then right-click on it and save.
  2. Within the Query Store page for the user database in SSMS, open the Tracked Queries report. Individually enter each query_id identified by the query above, select the forced plan, then right-click on it and save.

Once you have saved off a copy of every forced plan, then you can execute the script from Microsoft.

Note: If you are using Automatic Plan Correction, this will also un-force those plans (which would have been forced automatically).

At this point, queries that previously had a forced plan may have performance issues.  It’s possible that changes in your data distribution, changes in statistics, or perhaps even changes in the optimizer have caused a different plan to be generated that might be acceptable performance-wise.  If that is not the case, there is no ability to import plans into Query Store.  Each query that had a forced plan, that doesn’t get a new, “good” plan, may need to be run again to get the same plan into Query Store.  One of the easiest things to do is to find compiled values within the plan using the ParameterCompiledValue attribute, then re-run the query using those values.  You can then use data from Query Store, and compare against the saved plan, to verify it’s a consistent/stable plan.

Finding input parameters from the query plan

Finding input parameters from the query plan














I definitely recommend updating to the current Cumulative Update (and this is a general recommendation, not just because of the issue I’ve discussed here), and part of preparing for that upgrade means checking to see if you’re affecting by this issue, and addressing it as part of the upgrade process, rather than down the road.

T-SQL Tuesday #99: Life Outside SQL Server

T-SQL Tuesday

T-SQL Tuesday is a blog party held the second Tuesday of each month.

I am late to the party (I am often late to the party, just ask Aaron Bertrand, this month’s host).  I chose door #1 for this month’s T-SQL Tuesday Dealer’s Choice party.

If you follow me on Twitter, you know I’m a runner.  You might also know that I like spin.  And maybe you know that I’m a spin instructor at Psycle, a studio here in Ohio?

The bike...

The bike…












My regular class is on Tuesday mornings, but I sub for other instructors when my schedule allows.  Teaching spin is big in some places – like Soul Cycle which some say started the whole spin craze – to the point where instructing is a full-time job and it includes benefits.

I’m not in it for the money.

The extra cash is nice, but what I love is watching people evolve, and get better.

I’m a coach at heart.

I have found that I love not thinking about how I’m doing, but rather thinking about how to get someone else to do their best.

The studio...

The studio…










This is why I teach

Both spin, and SQL Server.  Off the bike my favorite course is IE0, for the Accidental/Junior DBA.  The first day everyone is pretty quiet – they don’t want to share what they don’t know.  By the last day everyone has realized that no one is an expert, and they will tell stories and ask the fun “why” questions.

This happens in spin.

People show up the first ride and they are afraid they’ll be the worst rider in the room.  A few rides later and they’re asking questions about their bike set up, or sharing how they’re feeling about class.  Weeks, months, even years go by and you see those individuals get stronger, faster, more efficient…and in some cases become instructors themselves.

Rock Hall Ride (thanks Colleen!)

Rock Hall Ride (thanks Colleen!)












That happened to me.

I started riding to become a stronger runner, but I found that I loved the dark room, loud music, and sanctity of the spin studio just as much as I loved the fresh air, sunshine, and the sound of my feet running.  It is, at our studio, therapy on a bike.  Some may scoff at the notion, others attend and find it isn’t their thing.  And that’s cool.  You do you, you find your thing and go all in, and spread that light wherever you can.  But if you find yourself in Cleveland and you’re up for a ride, let me know :)





Query Store and “in memory”

If you’ve ever been to one of my sessions you know that I really like demos.  I find they can illustrate how things work extremely well and I use them to compliment an explanation.  I’m a very visual learner so it also helps me to understand and then explain a concept.  The drawback of demos is that they sometimes fail, partly or entirely.  I really work to make mine as infallible as possible, but every so often I run into a problem.

When I was working on Query Store demos, one thing I noticed is that sometimes the data from the runtime stats system view seems to be duplicated.  And this happens in my Pluralsight course on Query Store and Automatic Tuning, funny enough.  After restoring a database and stepping through a blocking scenario, when I query the runtime and wait stats with the query below, I get the following output:

[rsi].[start_time] AS [IntervalStartTime],
[rsi].[end_time] AS [IntervalEndTime],
FROM [sys].[query_store_query] [qsq]
JOIN [sys].[query_store_query_text] [qst]
ON [qsq].[query_text_id] = [qst].[query_text_id]
JOIN [sys].[query_store_plan] [qsp]
ON [qsq].[query_id] = [qsp].[query_id]
JOIN [sys].[query_store_runtime_stats] [rs]
ON [qsp].[plan_id] = [rs].[plan_id]
JOIN [sys].[query_store_runtime_stats_interval] [rsi]
ON [rs].[runtime_stats_interval_id] = [rsi].[runtime_stats_interval_id]
JOIN [sys].[query_store_wait_stats] ws
ON [qsp].[plan_id] = [ws].[plan_id]
AND [rsi].[runtime_stats_interval_id] = [ws].[runtime_stats_interval_id]
WHERE [qst].[query_sql_text] LIKE '%UPDATE%'
AND [rs].[execution_type] = 0
ORDER BY [rsi].[start_time] ASC, [ws].[total_query_wait_time_ms] DESC;


Query Store Runtime and Wait Statistics

Query Store Runtime and Wait Statistics





You can see that there are two rows for the same query_id and plan_id, but the count_executions is different, as are the avg_duration and avg_logical_io_reads values .  The data is not truly a duplicate.  This behavior occurs because the Query Store data is stored in memory before it is flushed to disk, and when you query the data SQL Server is pulling it from both locations (and doing a UNION ALL) and displaying it in the output.  If I waited a bit and ran the query again, the two rows for that interval would probably disappear – most likely because the in memory data had been flushed to disk.  You can force the data to be flushed manually using sp_query_store_flush_db:

EXEC sp_query_store_flush_db;

After I execute that stored procedure, when I query the runtime and stats data again, the output is only one line:


Query Store Runtime and Wait Statistics After SP Flush

Query Store Runtime and Wait Statistics After SP Flush





The Query Store data is held in memory as an optimization – if the runtime stats had to be updated on disk every time a query executed, the amount of I/O could easily overload a high-volume system.  Therefore, data is stored in memory and flushed to disk based on the DATA_FLUSH_INTERVAL_SECONDS setting for Query Store, which defaults to 15 minutes.  I recommend reading How Query Store Collects Data for more detail (and a nice visual).  It’s important to understand that even though I keep writing “in memory” and the documentation states that the sp_query_store_flush_db procedure “flushes the in-memory portion of the Query Store data to disk”, this data does not reside in In-Memory OLTP structures.

Note: You can use Query Store to capture data for Natively Compiled stored procedures that access In-Memory OLTP objects, but you need to enable the collection of execution statistics using sys.sp_xtp_control_proc_exec_stats, as described in Microsoft Docs.

If you’re using Query Store and you’ve run into similar behavior, hopefully this explains what you’ve seen and why, and you know how to address it going forward, if it presents an issue for some reason.

Lastly, just yesterday the Tiger Team released some code you may need to run if you’re using Query Store and you’ve upgraded to SQL Server 2017 CU3.  Please take a minute to review in case it applies to you!

Query Store Settings

In SQL Server 2017 there are nine (9) settings related to Query Store.  While these are documented in sys.database_query_store_options, I often get asked what the value for each setting “should” be.  I’ve listed out each setting below, along with the default value and considerations around changing the setting.



The default value for a new or upgraded database in SQL Server 2016 or SQL Server 2017 is OFF.  For Azure SQL Database, the default value is READ_WRITE.

If you want to enable Query Store, this needs to be set to READ_WRITE, which is the desired state.

You also have the option of READ_ONLY, whereby new queries, new plans, runtime statistics, and wait statistics (in SQL Server 2017) will not be captured, but any forced plans will still be forced.  This state can occur if you reach the MAX_STORAGE_SIZE_MB limit (see below).  You can check actual state against desired state using the query below:

SELECT [actual_state_desc], [desired_state_desc]
FROM [sys].[database_query_store_options];

It’s recommended to always run in a READ_WRITE state.  I have heard of some environments which switch between READ_WRITE and READ_ONLY.  If you want to understand your workload and have the data needed to troubleshoot performance issues, you need to be capturing information on a continual basis.



The default value for SQL Server 2016 and SQL Server 2017 is ALL.  For Azure SQL Database, the default value is AUTO.

With AUTO, queries that are insignificant from a resource utilization perspective, or executed infrequently, are not captured.  If you need to capture queries that may only execute a few times, or those that use very few resources, then use ALL.  Otherwise, use AUTO, as this will capture the relevant majority of your workload.

There is a third option, NONE, where no new queries are captured.  Runtime and wait statistics will continue to be captured for queries that are already in Query Store.

I recommend setting this option to AUTO, as the number of queries in your environment that need tuning/your attention is a small percentage of the total number of queries that execute.  You won’t miss out on important data if you exclude queries that don’t use a lot of resources or don’t execute very often.



The default value for SQL Server 2016, SQL Server 2017, and Azure SQL Database is 200.

This setting is an integer, so theoretically you can set it to 2,147,483,647!  If you don’t know how many distinct plans you might have for a query, you can use sys.dm_exec_query_stats and get a count of distinct query_plan_hash values for a given query_hash:

SELECT [query_hash], COUNT (DISTINCT [query_plan_hash])
FROM [sys].[dm_exec_query_stats]
GROUP BY [query_hash]

While I would like to believe that 200 distinct plans for a query is really high, I’ve talked to several DBAs who confirmed they had counts in the thousands.  Thus, you may need to increase this settings if you have queries that are unstable and generate a lot of different plans, and you want to capture each different plan.  Understand that a workload with a large number of plans for a query will require more space, hence the limitation.  You can set the limit lower than the possible number of plans to control the size, with the understanding that you won’t capture every plan variation.  The value of 200 is a good starting point for most environments.



For SQL Server 2016 and SQL Server 2017 the default value is 100MB.  For Azure SQL Database, the default value is specific to the tier (Basic = 10MB, Standard = 100MB, Premium = 1GB).

The Query Store data is stored in internal tables in the user database (in the PRIMARY filegroup, like other system tables) and exposed through catalog views.  You can configure how much disk space can be used by Query Store.

This settings should be increased for an on-premises solution.  It may need to be increased for SQL Database, there are multiple factors that affect how much space you will need for Query Store data.  These factors are:

  • The value for QUERY_CAPTURE_MODE; if you’re capturing ALL queries, you will have more information than if using AUTO.  The amount of data is difficult to predict – it depends on your workload (Do you have a lot of queries that run just one time?  Do you have a lot of queries that use very little resources?).
  • The length of time you retain data in Query Store (CLEANUP_POLICY).  The more data you keep, the more space you will need.
  • Whether you’re running SQL Server 2017 and capturing wait statistics information (WAIT_STATS_CAPTURE_MODE).  The wait statistics information is extremely valuable, but it is more data to keep and retain.
  • The value for INTERVAL_LENGTH_MINUTES.  The lower this value, the more runtime statistics data you will have and thus you will need more space.
  • Type of workload.  If you have an ad-hoc workload that has high variation in query text, then you will have more individual queries stored, and thus more plans and more runtime and wait statistics as that information.  If you have a stable workload that does not have ad-hoc queries or queries generated by dynamic strings or ORM tools like NHibernate or Entity Framework), then you will have a fewer number queries and less data overall.

As you can see, there is no “answer” for what the value for MAX_STORAGE_SIZE_MB should be.  I recommend starting with 2GB allocated, and then monitor via sys.database_query_store_options and Extended Events.  For some solutions, 1GB is plenty.  For other solutions, you may need 5GB or more.



The default value for SQL Server 2016, SQL Server 2017, and Azure SQL Database is 30, with the exception of the Basic tier for Azure SQL Database, which defaults to 7 days.

How much historical data do you want to keep?  If you’re a shop that develops in production, you might want to keep more history.  If your workload is pretty stable and you only roll-out changes quarterly or less frequently, 30 days may be enough information for you.  The more data that you retain, the more disk space you will need.  If you’re not certain about workload, I recommend starting with at least 30 days for this setting, and over the first couple months of use you’ll figure out if you want to keep older data.



The default value for SQL Server 2016, SQL Server 2017, and Azure SQL Database is AUTO, and I recommend leaving it as such.

With a value of AUTO, as Query Store gets close to the storage size allocated by MAX_STORAGE_SIZE_MB it will automatically purge out the oldest data to make sure there is enough space for new data.  There is a possibility for data that has not reached the CLEANUP_POLICY to be removed (e.g. if MAX_STORAGE_SIZE_MB is 2GB and CLEANUP_POLICY is 30 days, and you reach 2GB in 15 days, data will start to be removed).

You can set this to OFF, but in that scenario, if the MAX_STORAGE_SIZE_MB is reached the OPERATION_MODE will change to READ_ONLY and you will no longer capture new data.  It is recommended to leave this set to AUTO and adjust MAX_STORAGE_SIZE_MB as appropriate.



The default value for SQL Server 2016, SQL Server 2017, and Azure SQL Database is 900 (15 minutes).

It is recommended to leave this value at the default.



The default value for SQL Server 2016, SQL Server 2017, and Azure SQL Database is 60.

This is a critical setting, as it determines the window of time across which runtime statistics will be aggregated.  You can only select fixed values for this settings (1, 5, 10, 15, 30, 60, 1440).  The smaller this value, the smaller the window of time for which you will have runtime stats.  This will allow you to look at data at a more granular level.  However, the smaller the value the more data you will capture and thus the more space that is needed.

For the client environments that I support, I’ve set this to 30, as I like a smaller window of time for analysis and based on the performance issues I’ve had to troubleshoot thus far, that’s been a good window.  If you have space constraints or concerns, then leave it at the default of 60.



The default value for SQL Server 2016, SQL Server 2017, and Azure SQL Database is ON.

If you upgrade a database which has Query Store enabled from SQL Server 2016 to SQL Server 2017, the WAIT_STATS_CAPTURE_MODE will be enabled on upgrade.  If you have a database on SQL Server 2017 and enable Query Store, this option will be enabled.

I recommend enabling this option if you’re on SQL Server 2017 as this information can be extremely valuable when troubleshooting query performance.  Note that you may need to increase MAX_STORAGE_SIZE_MB to accommodate this additional data.

Query Store and Availability Groups

Last week at the PASS Summit I presented a pre-con and general session on Query Store. I had several questions related to Query Store and Availability Groups, so I thought I’d pull them all together and answer them here.


Q: What happens to the Query Store data when a database is in an Availability Group?

A: You can enable Query Store for any user database, including one in an AG, and since that data is stored in internal tables in the database, it exists in the replica copies as well (just like other system tables and user tables).


Q: Can you enable Query Store for a read-only replica?

A: No.  Because the replica is read-only, and Query Store inherently writes data TO the database, you cannot enable it to capture queries that are executed against that read-only copy.  I did create a Connect UserVoice item for this request.  If this is of interest to you, please up-vote it: Enable Query Store for collection on a read-only replica in an Availability Group.  The more votes this has, the better the possibility that Microsoft will implement it, so feel free to share with your friends and have them vote too!

*Update March 8, 2018: Connect has ended and all requests were ported to UserVoice…and your votes are still needed.  Please vote when you have a chance!


Q: Can you force a plan for a query on a read-only replica if you force it first for that query on the primary?

A: No.  With a read-only database this is not possible.


Q: Can you create a separate user database on the secondary, enable Query Store for it, and then issue queries against the read-only replica through that user database and have them captured in Query Store?

A: No.  (But it’s a really creative idea.)


Have other questions related to Query Store and AGs?  Let me know!  Happy to answer them.

PASS Summit 2017: Day 2

Day 2 is starting here at PASS Summit in Seattle – watch this space for updates the next hour and a half!

Grant Fritchey is kicking off day 2!  I’m a big fan of Grant.  He talks about the community and how people should take advantage of what’s available here at Summit.  I couldn’t agree more – I wouldn’t be where I am in my career without this conference, nor would I have the friends I do all over the world.  Grant hands it over to Denise McInerney, VP of Marketing, and Denise shares her journey within PASS (she’s a 6 year Board Member).  Denise continues driving the point about the value of this conference and PASS.  She then talks about the volunteers for PASS, and announces the winner of the PASSion Award.  This year’s winner is Roberto Fonseca.

Denise is talking about the survey feedback from the past couple years, and session evaluations at PASS.  *PLEASE* complete these by the end of next week (if not earlier) – both PASS and the speakers truly value this feedback.  If you provide additional feedback there is a Board Q&A tomomrrow at Friday, 2PM. Today is the WIT lunch, and Denise announces that next year’s Summit is  November 6 – November 9, 2017.  Denise introduce Rimma Nehme, a Group Product Manager/Architect for Azure Cosmos DB and Azure HDInsight at Microsoft.  Today is going to uncover CosmosDB.  It will be technical!  Let’s go!!

 Do we need another database?

This is the wrong question to ask.  If you look at the rising data problems and needs, most of the production systems today (particularly the ones designed in the 70s and 80s), the modern calls and needs are addressing these problems.  90% of the world’s data was created in the last 2 years alone.  The estimated growth in the next 3-5 years is 50x.  Another trend is global, and another is data is big.  Not just a few TB, but trends of companies processing hundreds of TB to pedabytes.  Every 60 seconds 200 million emails are generated.  Rimma is throwing out ridiculous numbers about the amount of data being generated.  I can’t keep up!

Data is also interconnected.  What you do in Seattle can be connected to another location in the world.  This the butterfly affect.  We are experiencing about 125 exabytes of data (that’s a lot of zeroes).  Companies are looking at ways of extracting that data and monetize that information.  Another trend is the balance of power continues to shift from structured to unstructured data.  About 80% of data originates in unstructured data. Never push the data to computation – push the computation to the data.

When dealing with distributed, you need to deal with a lot of differences.  For example, different architectures.  In 2010 an engineer inside Microsoft observed this and identified that we need a different architectures to deal with these fundamental differences in data at scale.  This is how Project Florence was born, which is the base of what is now CosmosDB.  It was one of the exemplary partnerships between Microsoft Research and the Azure Data team.

At the time they were working to address the problem of the data for large scale applications within Microsoft (e.g. XBox).  They tried the “earthly databases”, building something on their own, and these options weren’t working.  Hence project Florence to meet the internal needs.  A basic set of requirements were laid out:

  1. Turnkey global distribution
  2. Guaranteed low latency at the 99th percentiles, worldwide
  3. Guaranteed HA within region and globally
  4. Guaranteed consistency
  5. Elastically scale throughput and storage, at any time, on demand, and globally
  6. Comprehensive SLAs (availability, latency, throughput, consistency)
  7. Operate at low cost (this is crucial and important! – first customers were Microsoft departments)
  8. Iterate and query without working about schemas and index management (applications evolve over time and rapidly))
  9. Provide a variety of data model and API choices

This manifests into three principals that have evolved

  1. Global distribution from the ground up
  2. fully resource governed stack
  3. Schema-agnostic service

It is very hard to build any service (particularly with such requirements).

If it was easy, everyone would do it (via NASA).  So this is how CosmosDB was built.  This is used internally by Microsoft.  It is one of the fastest services in the cloud.  It is a ring-0 service, meaning it is available in all regions by default.  It is millions of lines of C++ code.  It is 7 years in the making, it is truly not a new services.  Here is what it looks like (a bit of marketing here).

The foundations of the service for a globally distributed, massively scale-able multi–model database service are

  1. comprehensive SLA
  2. five well-defined consistency model
  3. guaranted low latency at t the99th percentile
  4. elasticscale out of storage and throughput
  5. and…

Fine grained multi-tenancy.  This cannot be an after thought.  From left to right, you can take a physical resource like a cluster and dedicate to a single tenant (e.g. customer or database).  You can take an entire machine and dedicate.  You can go another step and take a machine to homogeneous customers.  The final level of granularity is taking that machine and dividing between heterogeneous tenants and providing performance and scalability.

In terms of global distribution, Azure has 42 regions world wife…36 are available, 6 are still being  built out.  You can span your CosmosDB across all of those regions.

Within a database account you have a database.  Within that you have users and permissions.  Within that CosmosDB is a container.  A container of data with a particular data model.  Below that are other user defined code.  The database may span multiple clusters and regions and you can scale it in terms of these containers.  It is designed to scale throughput and storage INDEPENDENTLY.  How is the system designed by the scene (10K foot view)?  Within regions there are data centers, with data centers there are stamps, within that there are fault domains, within that there are containers and within that the replicas.  Within the replicas are the data.  On the database engine this is where the secret sauce comes in – bw-indexes, resource manager, log manager, IO manager, etc.  On any cluster will see thousands or hundreds of tenants.  Need to make sure that none of the tenants are noisy.

Another tenant that is import is the concept of partitioning.  How does CosmosDB solve this?  The tenants create containers of data and behind the scenes these are partitions.  The partitions are comprised are 4 replicas.  This is consistent and reliable.  Each one is a smart construct.  Out of those partitions, you can create partition sets.  These can then span clusters, federations, data centers, regions.  You can overlay topologies to implement solutions that span across multiple regions across the planet.  You need to make sure that the applications then work really well (particularly when merge or split partitions set).  You have the partition which is a data block and then you can build the partition set of various topological.

What are some of the best practices?

  1. Always want to select a partition key that provides even distribution
  2. user location aware partition key for access locally
  3. Select a partition key that can be a transaction scope
  4. Don’t want to use the timestamp for write-heavy workloadso

The resource model summary : Resources, Resource model, partitioning model

Core capabilities Turnkey global distribution – this is adding regions with a click.  Yu can come to an Azure portal, you can see the map of the entire world and pick the regions where you want your data to be.  The data is replicated behind the scenes and then its available for access.  You’re not dealing with VMs, cores.  You can add and remove regions at any time and the application does not need to be re-deployed.  The connection between application and database is logical.  This is enabled by multi-homing capability API.  You can connect to physically to the end point.  Another capability is that you can associate priorities with each of the regions.  If there is an outage or failover in a region, the failover will occur in the order of priority, and that can be changed at any time.  Something added for customers is to simulate a regional outage (but don’t go crazy with this says Rimma!).  You can test HA of the entire application stack.

Another capability is being able to provide geo-fencing.  If you come from any other part of the world there can be regulations where data has to present in particular regions, so if data needs to stay withing a location for requirements, that capability is required.

How does AlwaysOn work?  By virtue of partitioning have multiple locations.  One replica goes down, the application will be unaffected.  If partition goes down, the application will go t partition in another region.  If an entire region goes down, the application will go to another region.  The data is always available.

Another area of interest is active writers and active readers in any region.  Right now turnkey provided at database level, but looking to push this down to the partition key level (a true Active Active topology).  Online backups are available, they are stored in Azure blob storage.  The key capability is that it’s intended for “oops I deleted my data”, it”s’ not for a data center going down (that’s hwy you have multiple regions).

Second capability is elastic scale out.  As data size, scale throughput independently.  Could start out with small amount of data and keep adding more and more.  Back end will seamlessly scale.  Transnational data tends to be small, web and content data is medium sized, and social data/machine generated data is much larger.  As data size grows or throughput grows, scale occurs and this happens seamlessly behind the scenes.  This is done with SSDs behind the scenes.

Resource governance is the next component.  As operations occur, they occur RUs.  You provision RUs that you need (how many transactions/sec to you need?).  All replicas (just a partitioning of data) get a certain budget of RUs.  If you exceed, you’ll get rate limited.  At any time can increase provision throughput.  Can then support more transactions/sec.  Can also decrease at any time.

RU is a read-based currency partitioned at granularity of a 1 second.  It is normalized across DB operations.  Cost the operations via machine learning pipelines that cost queries (e.g. scans, lookups, etc.).  Have run machine learning on models on telemetry data, and then calibrate the cost model accordingly for RUs.  ((DATA DRIVEN).  Back to partitioning model: at any time can change throughput and behind the scenes you can specify the throughput (RUs) you want.  Behind the scenes the re-partitioning will occur, and each one will get more RUs to provide the throughput asked for.  This is where splitting/merging partitions matters, but it happens behind the scenes and you don’t have to worry about it.

What about when you add regions?  You want to add more RUs so you don”t starve existing regions.  Those RUs are spread across all partitions and regions.  Rimma shows how one customer elastically provisioned resources during the holiday season to size up to meet demand, and then size down when no-longer needed.  In a 3 day period, Rimma shows a graph of RUs.  At the top end there are 3 trillion RUs.  (THREE TRILLION IN THREE DAYS PEOPLE)

Various nodes have a various number of RUs serving different workloads, and you can look at the different tenants and partitions in there.  Multi-tenancy and global distribution at that level is incredible.

Another tenant: Guaranteed low-latency at 99%.  This was a core requirement because time is money.  From the business part of view, twice as much revenue lost to slowdowns.  So the system is designed.  At 99th percentile, less than 10ms for the reads measured at 1KB document (which is =80-90% of workload).  At average, will observe lower latency (less than 2 ms for reads and 6ms for writes.  How is this accomplished?  Reads and writes from local region and SSDs done.  The database designed to be write optimized and using latch-free database engine.  All data is indexed by default.  This is a fundamental difference from relational databases, here we have automatically indexed SSD storage.  Customer example: application in California and data in far east.  Added another region and then latency dropped.  Over black Friday/cyber Monday latencies less than 10ms for reads and 15ms for writes.  Azure Cosmos DB allows you to be the speed of light.  If have a database in Chicago and have friends in Paris who want to read your data.  If this  was a central database they would request to read the data from Paris and getting that data from Chicago to Paris takes 80-100 ms.  With CosmosDB you get it in less than 10ms because of those regional locations.

The last here is the consistency model in CosmosDB.  How does it go?  When you are dealing with any distributed system, whether databases or other sytem, typically you are faced with fundamental trade off of latency, availability, consistency and throughput.  If centralized database all requests against primary copy.  With global distribution, get geo–replication get HA and low latency.  But what happens if one replica can’t communicate with others and updates are being made?  What kind of consistency guarantees are made?  This can be a problem!  Do you need to wait for data to be synchronized before you serve it?  Do you want strong consistency or eventual consistency?  Do you want the red pill or blue pill?  With a relational database you get a perfect consistency.  They won’t serve the data until quorum is an agreement. The price there is latency.  On the other hand, the whole movement of no consistency guarantees means low latency.  But real-world consistency is not a binary choice as just described.

What about something in between?  The research literature talks about the wild west of consistency models (not one or the other).  A parper recommended is Replicated Data Consistency Explained Through Baseball by Doug terry, a Microsoft Research individual.  Uses real-world examples from baseball.  Depending on who you are in the game, you might get value out of different consistency models.  The engineers asked the question: can we pick out an intermedicate consistency model and is easy to configure, programmable, presents clear trade-offs?  Most real-life applications don”t fall into those two extremes.  Bounded-stateless, session (monotonic reads and writes local to geo location), and consistent prefix (when updates applied, the prefixes are guaranteed to be consistent).

How is this accomplished?  use TLA+ specifications to specify consistency models.  If you don”t know, check out video by Leslie Lampert who is an important figure in how the system was designed.  Leslie was a Touring award winner for Paxis (sp?) algorithm and founding father of what is used in the stack.

Operationalized the five different consistency models.  Using telemetry to see then how those models are used.  Only 3% use strong consistency, 4% use eventual, and 93% are using the three models in between.  Depending on consistency model specified, might need more computational work, which requires RU.  Have to make trade offs accordingly, and you can monetize this and decide what’s’ best.

Comprehensive SLAs…high availability SLAs are not enough.  Microsoft is in the service business, not just the software business.  Typically services don’t give any SLA, or give for HA.  When tried to approach this problem, asked “What are all the things that developers and customers really care about?”  They care about performance, throughput, consistency, availability and latency.  SO this is the first service in the market that has published comprehensive SLAs that are backed up by Microsoft financially.  Can now see that guaranteed if come in and run workload, will get guaranteed performance, throughput, consistency, availability and latency .  Availability tracked at the tenant and partition level in 5 minute granularity.   Customers can see their run time statistics against their SLA.

Service is also multi-model.  Wanted to enable native integration with different data models.  Behind scenes just ARS model (atom-record-sequence).  All models get translated to ARS model.  Very easy for the service to then on-board other data models now and in the future.  If want document and graph, do not need two copies of data, it can be handled by the same set of data.  This is a powerful combination — to look at data through different lenses.

Why schema agnostic approach?  Modern applications that are built in the cloud are not static.  Can start with one schema, add more tables/new columns…need a robust approach to handle these scenarios.  The object model is schema-free.  The data gets stored as-is.  How do you query this data?  Behind the scenes the data is ARS.  At the global scale, dealing with indexes, schema, etc. is a nonstarter.  In CosmosDB there is schema agnostic indexing.  The indexes are a union of all document trees, and can then consolidate into one and only keep unique values.  All of this structure info is then normalized.  It is an inverted index which gives optimal write performance.  Can identify where documents located and then serve up.  The index overhead in practice is pretty small.  There is a published paper, Schema-Agnostic Indexing with Azure Cosmos DB, go read it!

The Bw-tree in Azure Cosmos DB is highly concurrent, non-blocking, optimized for SSDs.  Avoids random writes.  There are three layers, the b-tree, cache and log structured store (see paper).  Rhema is going faster now. I’m not kidding.  Bw-tree is implemented as delta updates.  There is a mapping table to the updates and updates stored as deltas (sounds like in-memory index structure?).

Rimma shows architecture of Query Processing, there are different semantics but have the same underlying components (compiler, optimizer, etc.).  The engine is very flexible and expect that in the future will host other run-times.  The multi-API approach allows native support for multiple APIs.  If want to store data in cloud but not re-write your app, you can.  There are more APIs coming in the future.  What does this strategy enable?

  • No recompilation needed
  • Better SLAs, lower TCO
  • leverage the existing OSS tool-chain and ecosystem and development IT expertise
  • Life and shift from on-premises to cloud
  • No vendor lock-in
  • Symmetric on-premises and cloud database development

All happy databases are alike, each unhappy database is unhappy in its own way (Kyle Kingsbury via Leo Tolstoy).

How run service?  Weekly deployments worldwide.  16 hours of stress testing every day.  It’s like magic factory across the globe.  Also run variant and invariant checks.  Bots that are fixing nodes that might have issues.  Consistency checking and reporting going over the data continually.

In conclusion…wanted to put herself in our shoes. It’s a lot of information to digest…particularly if not invested in this technology.  Why should you care?  Rimma brings up a quote from Darwin:

It is not the strongest species that survive, nor the most intelligent, but the ones most responsive to change.

Can try CosmosDB for free, no need to credit card info, etc.  Childhood dream of going to Cosmos (space) will be fulfilled.

Key points to remember:

  • global distribution, horizontal partitioning and fine grained multi-tenancy cannot be an afterthought
  • schema agnostic database engine design is crucial for a globally distributed database
  • intermediate consistency models are extremely useful
  • globally distributed database must provide comprehensive SLAs beyond just HA

This is a hidden gem, but the bigger message remember the entire NoSQL movement is a counter-culture movement. But the question is how would we build databases if we started today? Without the legacy that we know, would we look at things differently?  Would we focus on limitations or focus on the bigger picture?  Sometimes it is ok to break the rules and try to different things.  Life is too short to build something that nobody wants.  If we focus on real pain points, not the “nice to have things”, but really look at the issues and abandon our constraints and self–imposed limits, we can create a modern SQL.  Rimma ends by thanking Dharma Shukla and entire CosmosDB team.


PASS Summit 2017: Day 1

Hey friends!  After a one-year hiatus I am BACK at the PASS Summit and ready to blog the day 1 keynote :)  I will update this post throughout the morning so refresh every so often to see the changes.  You can also follow along on Twitter – check out the #PASSsummit hashtag.

Reminder: My session is today at 1:30 in 6B, Query Store and Automatic Tuning in SQL Server, I hope to see you there!

Today’s keynote is headlined by Rohan Kumar (who I just got to meet thank you Mark Souza) and he’s stated that it will be a lot fun – you can preview what’s coming here.  Rohan is the General Manager Database Systems Engineering for Microsoft, and there are a fair number of demos coming our way.


PASS President Adam Jorgensen starts off the day – this is the 19th PASS Summit.  Holy cow.  The PASS keynote is being streamed live via PASStv if you’re not available to be here in person.  If you are at the Summit this week and you have any [problem with your SQL Server implementation that you need answered, go to the Microsoft Clinic.  It is on the 4th floor near the Community Zone, and there are numerous Microsoft Engineers available to help.  It’s an amazing resource at this conference.

Adam takes a moment to thank the individuals that volunteer for PASS – the organization is primarily run by volunteers, and that includes the PASS Board.  The Board will have an open meeting on Friday at 2PM which anyone can attend. I f you have feedback or want to better understand how things work, definitely attend.  Outgoing PASS Board members are Jen Stirrup and Chirs Woodruff.  New elected members are John Martin, Diego Nogare, and Chris Yates.  Adam takes a moment to thank outgoing Past President Tom LaRock and Exec Board member Denise McInerney as their time on the Board comes to a close.

Please take time to meet our sponsors in the Exhibit Hall.  The support of our sponsors makes *so* many things possible not just at Summit, but throughout the year.

And Rohan takes the stage…

SQL Server 2017

Data, AI, and Cloud are three disruptive technology trends…and we need to figure out how to better migrate data to the cloud (I’m asking: how do we make it easier?).

At it’s core, the modern data estate enables simplicity.  It takes in any type of data, and allows a hybrid setup between on-premises and the cloud.  Rohan asks how many people believe they can move their data/solution to the cloud?  About 1% of the attendees raise their hand.  He then asks how many people think that deploying to the cloud or on-prem is what’s needed in the future?  The majority of people raise their hands.

SQL Server 2017 was released October 2, 2017, and SQL Server 2016 was released April 1, 2016…that’s a very fast release cycle for Microsoft, and that’s been possible because of the cloud-first approach, which translates to an increased cadence of SP and CU releases.  Reminder: in SQL Server 2017 there’s a shift to CU releases every month, and no more SPs.  Glenn blogged about this in September.  Rohan brings Bob Ward and Conor Cunningham on stage for the first demo.  They’re wearing Cowboys jerseys.  *sigh*  If you see Bob this week ask him how the Rangers did this year…

Bob and Conor step through a demo showing the performance benefit of a new HPE DL580 Gen 10, using persistent scalable memory NVDIMMs – a query that takes 15 seconds on SSDs takes about 2 seconds on the HP storage.  And it’s cheaper?  I’m deferring to Glenn for the hardware details!!

Bob introduces a “typical” parameter sniffing issue – and then shows how to use Automatic Plan Correction (which relies on Query Store under the covers)…which I’ll be showing today in my session as well!

New features in SQL Server 2017:

  • Advanced Machine Learning with R and Python
  • Support for graph data and queries
  • Native T-SQL scoring
  • Adaptive Query Processing and Automatic Plan Correction

There is much more available in 2017, as noted in the release notes.

Docker Containers

Tobias Ternstrom and Mihaela Blendea take the stage to talk about containers running SQL Server.  Mihaela shows the build definition, which starts a container based on the SQL Server build.  On top of that, restore production database to it and run any additional scripts (e.g. obfuscate and remove some data), then push out the images.  Tobias starts typing in a command line window…this I love.  He knows what he’s doing, but he’s always kind of winging it.  Tobais gives a sneak peak of a tool that shows up as being named Carbon, but Rohan introduces it as Microsoft SQL Operations Studio.  It works on Windows, Linux, and Mac to connect to a SQL Server database.  So at some point SSMS will be deprecated?  Yeah…just like Profiler 😉

Rohan comes back and talks a bit more about the cloud-first approach.  Azure SQL Database is updated regularly, and on a monthly basis new CUs are being pushed out (CU1 for SQL Server 2017 has ALREADY been released).  Multiple terabytes (yes TERABYTES) of telemetry data are captured every day from Azure implementations.  This feedback goes right into making the product better (how else do you think they’re able to release builds and CUs faster?).

Managed Instances

New deployment option in Azure: Managed Instances.  It’s currently in private preview, but you get an entire SQL Server instance with PaaS benefits.  This allows for much more of a lift and shift migration with minimal code changes.  Microsoft is also working on a database migration service – this will not be easy and may not work for every solution, but it’s a step in the direction of making that process better and more reliable.

Working with Large Data/BI Solutions

The next data is showing performance and scale with Azure SQL Database hosted by Danielle Dean, a Principal Data Scientist at Microsoft.  Reading in a lot of data – ingesting patient vitals into Azure database (1.4 million rows/sec via columnstore and in-memory).  Azure Machine Learning Workbench is then used to take an existing model and put it into Azure SQL Database.  Switching to SSMS (it’s not dead yet folks!!) you can query that model (it “looks” like a table), and use a stored procedure to predict against the model.

Scott Currie, the creator of Biml, on stage to talk about using the new Azure Data Factory with Biml.  I’ll admit, this isn’t a technology I know, so I”m just listening at this point :)

Azure SQL Data Warehouse Designed from ground up to separate out storage and compute so that you can scale each independently.  This design is very flexible and powerful, and provides significant ability to scale (up to 60 nodes currently), and it’s secure.  Also launched in early in October: Azure SQL Data Warehouse Compute-Optimized Tier.  This was a result of feedback from customers who had some DW queries that were running REALLY slow in Azure.  The solution caches column segments (data) locally, and this cache survives failures, which then provides high performance for DW queries.  Julie Strauss, a Principal Group Program Manager comes on stage to demo this.

Why are these behavioral analytic queries so compute-intensive?  It’s a combination of the data that’s needed and the complexity of the query.  Two kinds of analysis – funnel and cohort.  Both use telemetry from customer interactions/purchases from web site clicks.  The sophistication of the query is taking the vast about of data (100TB) and then fold it many times to create the different cohorts – the query takes about 6 seconds to read through that 100TB of data.  I’d like to know how this is done…

PowerBI quick demo against data with 100+ million rows.  Model built from Visual Studio sourcing data from Azure SQL Data Warehouse – very easy to deploy the model and then generate different visuals in PowerBI (clicky clicky drop was the “official” term used…I’m not kidding).  Ability to also scale in Azure very quickly so only using resources really need (and thus only pay for what need and use).

Ok, there was one more demo but I’ll admit, I’m fading.  :)

Rohan is wrapping up the keynote and talks about community and all of us working together and lifting each other up.  Rohan gives a shout out to members of the community that have really given a lot back to others.  He also mentioned Denny Cherry, a member of the community who had surgery a couple weeks ago.  I had a recent update from a colleague that Denny is doing well – please send good thoughts his way!

And that’s a wrap.  Off for a day of learning – have a great one friends!

Query Store Pre-Con at PASS Summit: More Details

In the time since my last post about my Query Store pre-con at the PASS Summit (it’s just about a month away!) I’ve gotten several more questions about the session.  I’ve consolidated them and provided answers here, and if anyone still wants to know more, please email me!

What version of SQL Server will you be running?

With the announcement on Monday from Ignite about SQL Server 2017, I can now say for certain that is the release I will be using.  I will call out differences between SQL Server 2016 and SQL Server 2017 as needed.  I don’t expect everyone who’s attending to be running 2016 or 2017, but I do expect that you’re in the planning stages for an upgrade, are going to start planning soon, or you’re looking for some solid reasons to share with your company about why you should upgrade.  I would argue that Query Store is a very good reason to upgrade, but that is definitely not the only one (check out the new features list for SQL Server 2016 and SQL Server 2017 – including enhancements to Query Store).

Will you have labs during your session?

No, but I will make all scripts available for attendees, and if you want to follow along during the day, you can get the scripts that morning.  I tweak demos right up until a session – it’s what I expect to be doing the Sunday before.  I’ll have all the scripts on a share that attendees can access the morning of the 30th.  I *love* the idea of labs during a pre-con, and I know that some other presenters do them.  Huge props, as it’s not easy to do.  In order to cover everything I want to cover, I don’t have enough time for in-depth labs that everyone can walk through from start to finish in the time allotted.  But again, feel bring to a laptop with SQL Server 2017 installed, along with the latest SSMS, and you can follow right along.

Are you giving anything away?

Besides knowledge?  😊  Yes, I will have codes for 30 days of free access to Pluralsight, which gives you access to over 50 courses from the SQLskills team, including my 3-hour course on Query Store.  If there’s something you miss during the pre-con, you can watch the Pluralsight course to pick it up, or further enhance what you learned.  I’m also working on a new course about the enhancements to Query Store in SQL Server 2017 and Automatic Tuning, which I’m also covering in my full day session.

Additional thoughts…

I’m also hosting a panel session at Summit and the organizer has emailed me to discuss how we handle questions during the session.  In the case where there are a large number of attendees, sometimes people hesitate to ask questions, and sometimes it can slow down the flow of the session.  While I am not setting records in terms of attendance, there are a lot of people that have signed up (which is fantastic) and I do want to make sure that everyone has a chance to ask their questions.  I’ve thought about using Twitter, and I know that Slack has been suggested as an option.  I’m still thinking about it.  If you’re signed up and have a preference, feel free to let me know in the comments!

That’s it for the moment, but please keep those questions coming.  Again, I want to make sure this is the right session for you to attend – there are a lot of great choices this year!  Either way, I look forward to seeing at Summit next month!


Changes to query text and the effects in Query Store

In this week’s Insider newsletter, Paul talked about an interesting customer issue I ran into last week related to Query Store, and an inadvertent change to a query’s text.  I thought I’d provide some demo code so that those of you using (or planning to use) Query Store could see how this shows up in your database.

Recreating the issue

I started by restoring a copy of the WideWorldImporters database, which you can download here.  I enabled Query Store and cleared out the data, just as a precaution.

USE [master];
RESTORE DATABASE [WideWorldImporters]
FROM  DISK = N'C:\Backups\WideWorldImporters-Full.bak' WITH  FILE = 1,
MOVE N'WWI_Primary' TO N'C:\Databases\WideWorldImporters\WideWorldImporters.mdf',
MOVE N'WWI_UserData' TO N'C:\Databases\WideWorldImporters\WideWorldImporters_UserData.ndf',
MOVE N'WWI_Log' TO N'C:\Databases\WideWorldImporters\WideWorldImporters.ldf',
MOVE N'WWI_InMemory_Data_1' TO N'C:\Databases\WideWorldImporters\WideWorldImporters_InMemory_Data_1',
STATS = 5;

ALTER DATABASE [WideWorldImporters]

ALTER DATABASE [WideWorldImporters]

I then created a stored procedure with just one query in it:

USE [WideWorldImporters];

CREATE PROCEDURE [Sales].[usp_GetFullProductInfo]
@StockItemID INT

FROM [Sales].[Orders] [o]
JOIN [Sales].[OrderLines] [ol]
ON [o].[OrderID] = [ol].[OrderID]
WHERE [ol].[StockItemID] = @StockItemID
ORDER BY [o].[OrderDate] DESC;

Then I executed the stored procedure twice, with two different input parameters.  I purposely used WITH RECOMPILE here because I knew the values would generate different plans.

EXEC [Sales].[usp_GetFullProductInfo] 90 WITH RECOMPILE;

EXEC [Sales].[usp_GetFullProductInfo] 224 WITH RECOMPILE;

Within Object Explorer I then drilled into the Query Store reports (Databases | WideWorldImporters | Query Store) and double-clicked to run Top Resource Consuming Queries.  My query has two different plans:

Initial query execution, two plans

Initial query execution, two plans










Plan_id 1 has a clustered index scan with a filter, that feeds into the probe phase of a hash match (with a columnstore index scan for the build). This was generated with the input value of 90.

Plan 1 for query_id 1

Plan 1 for query_id 1











Plan_id 2 has the same columnstore index scan, but it feeds into a nested loop, with a clustered index seek for inner input, and was generated with the input value of 224.

Plan 2 for query_id 1

Plan 2 for query_id 1











Now let’s suppose I decide to force one plan for that query. After analysis, I decide to force the second plan (plan_id 2), which I can do either through the UI, or using a stored procedure. Since change control and documentation is a good thing, we’ll use the stored procedure:

EXEC sp_query_store_force_plan @query_id = 3, @plan_id = 8;

At this point, if I re-run the stored procedure with the two different input parameters and WITH RECOMPILE, I will get the plan with the nested loop.

EXEC [Sales].[usp_GetFullProductInfo] 90 WITH RECOMPILE;

EXEC [Sales].[usp_GetFullProductInfo] 224 WITH RECOMPILE;
SP execution after plan is forced

SP execution after plan is forced
























Now…let’s assume that this forced plan is used going forward and there are no issues. And then let’s assume that a developer decides to add some comments to the stored procedure, and they know they should use ALTER to keep the object_id the same…but somehow, a couple extra spaces end up in the query.

ALTER PROCEDURE [Sales].[usp_GetFullProductInfo]
@StockItemID INT
This is getting information based on ID
*may need to add more columns per BL
FROM [Sales].[Orders] [o]
JOIN [Sales].[OrderLines] [ol]
ON [o].[OrderID] = [ol].[OrderID]
WHERE [ol].[StockItemID] = @StockItemID
ORDER BY [o].[OrderDate] DESC;


I re-run the stored procedures again (WITH RECOMPILE) and now I get that other plan again for the input value of 90:

SP execution after ALTER, spaces inadvertenly added

SP execution after ALTER, spaces inadvertenly added




















If I look in Query Store, I can see I now have two queries that look nearly identical:

Two queries in QS after SP was changed

Two queries in QS after SP was changed







There are different query_id values in sys.query_store_query, as well as different entries for each query in sys.query_store_query_text. Both queries are still tied to the stored procedure (object_id 1483152329) which can be confusing if you don’t understand what occurred. In order to confirm which query has executed most recently, you can use the query below, which joins both system views (replace the query_ids as appropriate):

FROM [sys].[query_store_query] [qs]
JOIN [sys].[query_store_query_text] [qst]
ON [qs].[query_text_id] = [qst].[query_text_id]
WHERE [qs].[query_id] IN (1, 14);
Information for both queries from Query Store views

Information for both queries from Query Store views






The take home message here is that you need to be careful when changing objects (stored procedures, functions) where you have queries with forced plans. Inadvertent changes in spacing or casing create entirely separate queries in Query Store, which means that the original query with a forced plan is no longer in use.  You’ll either have to ALTER the procedure again without the extra spaces in the query (which may not be as easy as it sounds), or get the new version of the query to execute the “right” plan, and then force that plan.  It may be appropriate to set up monitoring for object changes, or teach your developers how to identify what queries are forced and to what objects they below (hint: use the Queries With Forced Plans report that’s available in SSMS 17.x). Hope this helps, and if you want to learn more about Query Store, consider my full day pre-con at Summit next month where we’ll cover this type of scenario and a whole lot more! Feel free to reach out if you have questions about it :)

p.s. did you see that they announced the release date for SQL Server 2017? I’ll be running that build at my pre-con!

Query Store Pre-Con at the PASS Summit: Is it right for you?

I received an email over the weekend asking about my pre-con at the PASS Summit, my general session at the Summit, and my Query Store course on Pluralsight. The individual wanted to know the requirements for the pre-con, and what overlap exists between these three. Great question.

First, feel free to review the abstracts for all:

PASS Summit Pre-Con, October 30, 2017 (Seattle, WA)
Solving Common Performance Problems Using Query Store

PASS Summit General Session, Date TBA (Seattle, WA)
Query Store and Automatic Tuning in SQL Server

Pluralsight, online
SQL Server: Introduction to Query Store

None of these courses require pre-existing knowledge of Query Store.

The Pluralsight course starts at the beginning and walks you through configuring and using Query Store in SQL Server 2016 in find performance issues both retroactively and proactively (3 hours total).

The general session at the Summit discusses Query Store at a high level (what it is and how to use it), and talks about the new Automatic Tuning feature in SQL Server 2017 (Automatic Plan Correction) as well as Automatic Index Management in Azure SQL Database (75 minutes).

My full day pre-con covers everything from Pluralsight and the general session, and a whole lot more. If you want:

  • all the gory details on what Query Store is, how to configure it, and what data exists
  • best practices
  • a slew of demos about how you can use it to find performance issues (out-of-the-box Query Store methods and custom options not documented elsewhere)
  • tons of scripts that you can take home and use immediately
  • details about the wait statistics data added to Query Store in SQL Server 2017
  • additional uses for Query Store (beyond what’s documented)
  • how to use Automatic Plan Correction in SQL Server 2017 (automatic and manual) and what Automatic Index Management looks like in Azure SQL Database
  • an overview of how to visualize Query Store data

then the pre-con is going to give you all that and whatever else I can find time to fit in.  It is a packed day and I am in the thick of pulling all the slides and demos together (so if there’s something you want to see/know that you don’t see mentioned here, feel free to email me!).

I hope this answers any questions you have about my pre-con at Summit and other Query Store sessions available, but if not, just contact me!

Have a great week, and to my friends in the south – the Stellato family is keeping you in our thoughts.