-> Please refer “https://jbswiki.com/2017/06/15/stretch-database-in-sql-server-2016/” if you want to setup Stretch database from scratch. In this article, I will be adding table Table3 to the existing stretch database.
-> Let’s create the required objects for this demo on the already configured Stretch database JB_StretchDB,
use JB_StretchDB
go
create table Table3(
sno int primary key identity (1,1),
sname varchar(255),
Year int)
-> Populating tables Table3 with some data,
set nocount on
insert into Table3 values(replicate(‘A’,25),1980)
go 10000
insert into Table3 values(replicate(‘B’,25),1981)
go 10000
insert into Table3 values(replicate(‘C’,25),1982)
go 10000
insert into Table3 values(replicate(‘D’,25),1983)
go 10000
insert into Table3 values(replicate(‘E’,25),1984)
go 10000
-> Looking at the data,
select sname, year, count(*)
from Table3
group by sname,year
-> Select the table that will be added to stretch database and perform as shown in the screenshot,
-> Click on “Entire Table” under “Migrate”.
-> Monitoring the status for table3,
-> Executing the below query and looking at the execution plan. The execution plan shows us that we are querying 10000 rows from the On-Premise database and 40000 rows from the Azure database.
select sname, year, count(*)
from Table3
group by sname,year
Thank You,
Vivek Janakiraman
Disclaimer:
The views expressed on this blog are mine alone and do not reflect the views of my company or anyone else. All postings on this blog are provided “AS IS” with no warranties, and confers no rights.