r/SQLServer • • Nov 17 '16

[AMA] Microsoft SQL Server - 11/18

Hi Everyone!  

We're from the Microsoft SQL Server Engineering Team and we want you to ask us anything!  

We're posting this a bit early so you can start asking questions - feel free to start asking and we'll start answering Friday 11/18 at 9:30 PDT until 14:00 PDT. We'll have members from the Engineering teams participating in the AMA. This includes folks working on

  • SQL Server Features such as Columnstore, In-Memory OLTP, Row-Level Security, PolyBase, Stretch, or any of the features listed here.

  • Database Tools for Microsoft SQL Server and Azure SQL Database (SSMS, SSDT, SSRS, SSIS, SSAS, SSMA, SQLPS, CLI Tools)

  • Azure Portal for Azure SQL DB, Azure Elastic Database Pools or Azure Virtual Machines with SQL Server

  • R Services for predictive analytics, machine learning, and using scalable R packages with SQL Server technologies

  • Developing with SQL Server using the language of your choice (Examples. Node, Python, Java, etc.) or connecting your app to SQL Server using our drivers (ODBC, JDBC and open source drivers)

  • Migrating or Building Apps and Solutions with SQL Server and the resources we have available to help you get the most out of SQL Server.

  • [SQL Server on Linux] (https://www.microsoft.com/en-us/sql-server/sql-server-vnext-including-Linux)

  • [SQL Server 2016 Service Pack 1] (https://blogs.technet.microsoft.com/dataplatforminsider/2016/11/16/sql-server-2016-service-pack-1-generally-available/)

Here are some question ideas:

  • What’s new in SQL Server Service Pack 1 and SQL Server on Linux?

  • How does your team take the feedback from the community?

  • What tools would I use to migrate my database to SQL Server?

  • What’s a cool trick you don’t think most customers know about?

You can ask us anything about our public products or about the team. If there's a topic that's not listed above, ask it anyways! We'll do our best to answer it. We cannot comment on unreleased features and future plans, though :) Tweet at us with #SQLServer and follow @SQLServer to keep up to speed with what the SQL team is working on. After this AMA, you can also post questions here in reddit or tweet at us any time.

    Update@9:50 PST Hey Everyone! We are starting to answer the questions! Thanks for all the awesome questions so far. keep them coming! :)

    Update@2:15 PST Hey Everyone! Wow. Over 100 questions. Thanks for joining us today and participating in our SQL Server AMA! We're currently wrapping up the AMA, but we will do our best to answer the remaining questions. Going forward, the SQL Server Team will be more active on this subreddit. We're particularly excited to hear what you have to say about SQL Server v.Next!  

Also, tell us what you thought about this AMA Event by taking our survey: https://survey.microsoft.com/211438

67 Upvotes

386 comments sorted by

View all comments

18

u/willhaney Nov 17 '16

What’s a cool trick you don’t think most customers know about?

0

u/[deleted] Nov 18 '16

[deleted]

3

u/tmsquasher Nov 18 '16

I'll be honest -- I didn't learn about this until very recently, and it's incredible.

1

u/TheElusiveFox Nov 19 '16

Some one at work taught me this about 6 months ago and it changed my life.

2

u/Cryptopone Nov 18 '16

I remember reading that post but totally forgot about the shortcut. Could have used it a few times this week. Thanks :)

2

u/BananaRepublican73 Nov 18 '16

Yeah, the Midnight DBA guys showed us that one as part of their regex / scripting class. It blew some skirts up, I can tell you that much.

2

u/alinroc 4 Nov 18 '16

And that works in a lot of other editors as well. Not just SSMS.

2

u/GiovaniS Nov 19 '16

This one is awesome. It's essentially the same thing but you can also do this 1)Click where you want to start 2)Ctrl + Alt 3)Drag up or down

8

u/sanagama Nov 18 '16 edited Nov 18 '16

Here's one that's available in the the latest version of SSMS v17.0 RC1.  

  1. Launch SSMS  

  2. Press Ctrl + Q to go to Quick Launch  

  3. Type: PresentOn   This adjusts fonts in Object Explorer and code windows to optimize for presentations.

1

u/sbrick89 Nov 18 '16

don't have v17, so i'm curious... what types of adjustments does it make? usually it seems that people tend to zoom in, possibly adjust font, sometimes color scheme (such as the VS dark theme). I'm curious what you decided on.

1

u/sanagama Nov 18 '16

Right now, 'PresentOn' adjusts the fonts and makes then bigger for presentations, which minimizes zooming in. Do file items on Connect for more enhancements and we'll take a look.

3

u/Jeff_Bernhardt Nov 18 '16

There is a magic trick you can perform with SSIS. Create a dataflow from any old source (even from the script source) and terminate the data flow with a Data Streaming destination component. Deploy the package. Then run the "Data Feed Publishing Wizard" In the end you will get a SQL Server view that runs the SSIS package on demand and streams the rows out the end of the pipeline.

3

u/josdebruijn Nov 18 '16

It seems a lot of customers are not familiar with ALTER DATABASE CURRENT. You can always run ALTER DATABASE statements in the current database without specifying the name. This is great for scripting.

Another one is that you can actually get batch mode execution (usually limited to only columnstore) with traditional clustered and nonclustered indexes: simply create a filtered nonclustered columnstore index with a filter that has a contradiction (e.g., 1=2). You will start getting batch mode and thus faster execution for your analytics queries.

I also always like to call out that you can avoid contention in tempdb by replacing traditional TVPs and temp table with memory-optimized objects: https://blogs.msdn.microsoft.com/sqlserverstorageengine/2016/03/21/improving-temp-table-and-table-variable-performance-using-memory-optimization/

Finally, too few users are taking advantage of the compression options in SQL Server (available in all editions since SP1): PAGE and ROW compression have really limited impact on CPU utilization, and can even speed up the workload (since more data fits in memory, and less IO is required), while reducing the storage footprint. Columnstore compression goes a lot further than PAGE compression - it reduces the storage footprint even further, and is specifically optimized for analytics queries, meaning that query execution will be much faster for analytics. Finally columnstore_archival compression applies further archival compression to reduce the storage footprint even further (at the cost of some CPU). https://msdn.microsoft.com/en-us/library/cc280449.aspx

1

u/Jeff_Bernhardt Nov 18 '16

This is true for any SQL provider, but it might not be obvious: If you ever need to test reading a LOT of data from a server but you only care about the servers ability to stream out rows, just create a small table (Foo with 2 columns and like 16 rows) and then say SELECT * from Foo,Foo,Foo,Foo,Foo. you just got 10 columns and a million rows.

1

u/Jeff_Bernhardt Nov 18 '16

Another oldie but goodie: If you need to sample data at random from a set of table and you want to preserve referential integrity (I want to get 10% of my customer but also get ALL of the purchases that the 10% made) you can use a primary key as a seed for the random function. Use the same key (foreign now) for the related tables. So… SELECT * from Sales where Rand(CustID) < .1 the trouble with SQL Servers random function is that it doesn’t change much with similar seed values. To compensate you might need to pick out the more random bits that are 6 or 7 digits down the result ( AKA the fractional part of Rand(CustID) * 100000 )

-1

u/Saitama_Punch Nov 18 '16

Not so much a trick, but I think that the ability to use features like Columnstore, Partitioning, Always Encrypted and a bunch of other features in Standard, Web, Express and LocalDB is pretty cool. Used to be only available in Enterprise Edition. Other folks can add to this list :)

2

u/airalchemist Nov 18 '16

It's such a lame answer =(