Limitations of using Stretch Database

As you saw in the previous section, there are many limitations when you work with Stretch Database. You can distinguish between limitations that the prevent usage of Stretch Database and limitations in database tables that are enabled for stretching.

Limitations that prevent you from enabling the Stretch DB feature for a table

In this section, you will see the limitations that prevent you from using Stretch DB. They can be divided into table, column, and index limitations.

Table limitations

You cannot enable the Stretch DB feature for any SQL Server table. A table should have Stretch DB-friendly properties. The following list shows the table properties that prevent the use of the Stretch DB feature:

  • It is a memory-optimized table
  • It is a file table
  • It contains FILESTREAM data
  • It uses Change Data Capture or Change Tracking features
  • It has more than 1,023 columns or more than 998 indexes
  • Tables referenced with a foreign key
  • It is referenced by indexed views
  • It contains full-text indexes

The list is not so short, but let's see how huge these limitations are in practice. Despite their power and a completely new technology stack behind them, memory-optimized tables are still not in use intensively. From my experience, I can say that most companies still don't use memory-optimized tables in production environments due to the lack of use cases for them, hardware resources, or even the knowledge required for their implementation and configuration. In addition to this, memory-optimized tables usually store hot data, data that is frequently needed and whose content is not intended to be sent to the cloud. Therefore, you cannot say that the first limitation is a huge one. You will spend more time on memory-optimized tables later in this book (in Chapter 11, Introducing SQL Server In-Memory OLTP and Chapter 12, In-Memory OLTP Improvements in SQL Server 2016).

File Table and FILESTREAM tables appear frequently in the list of limitations for new SQL Server features. The same is true for tables using Change Data Capture or Change Tracking features. They are simply not compatible with many other features since they address specific use cases. Therefore, I am not surprised to see them in this list. Full-text indexes and indexed views also prevent Stretch DB usage. From my experience, in companies that I have worked with or where I was involved as a consultant, less than 10% of tables belong to these categories. According to all of these limitations, I would say that the potential of Stretch DB is slightly reduced, but not significantly. However, the most important limitation is that a table cannot be referenced with a foreign key. This is an implementation of database integrity and many tables are and should be referenced with foreign keys. Therefore, this is a serious limitation for Stretch DB usage and significantly reduces the number of potential tables that can be stretched.

Note

You should not disable foreign key relationships in order to use the Stretch DB feature! I would never suggest removing any database object or attribute that implements data integrity to gain performance or storage benefits.

However, this is just the beginning; more limitations will come in the next subsection.

Column limitations

Even if your table does not violate constraints from the preceding table of limitations, it is still far away from fulfilling the conditions for stretching. The following properties and characteristics of table columns don't support the Stretch DB feature:

  • Unsupported data types: Deprecated large data types (text, ntext, and image), XML, timestamp, sql_variant, spatial data types (geometry and geography), hierarchyId, user-defined CLR data types
  • Computed columns
  • Default constraints
  • Check constraints

Let's repeat a similar analysis of the reduced potential of Stretch DB for the items from this list. I think that Microsoft has a balanced approach with deprecated data types; they are not removed in order to prevent the breaking of changes in legacy code, but all new features don't support them. This is completely correct and it should not be considered a limitation.

The other unsupported data types are used rarely and do not represent a huge limitation.

Note

You can find user-defined CLR data types in a list of limitations for almost all SQL Server features in recent releases. This is also one of the reasons they are not so popular or frequently used.

However, the most important limitation in this list is that a table column in a Stretch Database cannot have a default or check constraint. This is a huge limitation and significantly reduces the usage and importance of the Stretch DB feature!

Also, as mentioned before, you should not remove database objects created to implement database integrity just to enable Stretch DB. Default constraints and foreign keys are the reasons why there is not a single table in the AdventureWorks2014 database that is ready for stretching.

Limitations for Stretch-enabled tables

If your table survives these limitations and you have enabled it for stretching, you should be aware of these additional constraints:

  • Uniqueness is not enforced for UNIQUE constraints and PRIMARY KEY constraints in the Azure table that contains the migrated data.
  • You cannot UPDATE or DELETE rows that have been migrated or rows that are eligible for migration in a Stretch-enabled table or in a view that includes Stretch-enabled tables.
  • You cannot INSERT rows into a Stretch-enabled table on a linked server.
  • You cannot create an index for a view that includes Stretch-enabled tables.
  • Filters on SQL Server indexes are not propagated to the remote table.
  • These limitations are not unexpected; the Azure portion of data is automatically managed and it should be protected from direct access and changes. Therefore, these limitations are acceptable, especially compared to all those listed in the previous sections.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset