Pragmatic Works Nerd News

Azure SQL Database Elastic Query

Written by Delora Bradish | Oct 11, 2018

Just a note that our Azure Every Day posts this week will be stepping away from our normal posts as our regular bloggers are tied up with our Azure Data Week virtual conference all week. Hope you are registered and attending this great week of Azure sessions! Instead, we will be posting some Azure blogs written by some of our consultants and a couple old favorites. We’ll be back to our regularly scheduled program of new Azure content each weekday starting next Monday, Oct. 15th!

Today we'd like to share a blog on Azure SQL Database Elastic Query by Delora Bradish: 

Querying across cloud databases is supported in Azure through elastic queries (in preview).  You can read more about that here, but I thought a good talking point would be to briefly compare to elastic query to PolyBase.  You can read about PolyBase here.
 
Note: At the righting of this blog post, an Azure Data Warehouse could not serve as a "principal" in an elastic query, but it can be the "secondary".

These two Azure features have similar setup.  They both require ...
  1. A master key
  2. A database scoped credential
  3. External table definitions
Elastic queries; however, allow you to not only SELECT from an external data source, but, you can also execute stored procedures.  In my thinking, the elastic query is as close as we are going to come to linked servers in Azure.  The definite downside is the defining of external tables in the principal.  These definitions must match the secondary schema name, table or view name.  The external table can omit columns, but it cannot rename or add columns.   This poses a bit of a deployment problem for the secondary when table definitions are changed -- the DDL changes must now be perpetuated in the principal external table definition.  The above images depicts vertical partitioning, but horizontal partitioning is worth a read.

Polybase is about linking to unstructured data, not another database.  That is truly the short version of the matter.  On both principal servers shown above the t-sql syntax is the same SELECT ColumnName FROM externalSchemaName.TableName.   It is not evident what feature you are using: Elastic Query or PolyBase.  Although you can JOIN an internal and external table together, this might fall under the heading "I can, but I won't".  It really depends on the size of your tables.  I personally do not feel that UNION ALL poses the same performance risk.

Conclusion: All said, elastic query is really a nice Azure feature which can solve data migration problems and an easy sharing of reference data.  It surely is not a replacement for ETL -- all things in moderation, my friend!  There remains a solid need for SSIS or ADFv2.   For every Azure offering there is an appropriate implementation place.