SQL Server distributed Database performance testing

Source: Internet
Author: User
Tags db2

I use three SQL Server 2012 to build a distributed database, 140 million data a year roughly evenly stored in the three servers, each server storage 4 months of data, physical server configuration is basically the same, memory 16G, dual-core CPU 3.6GHz.

1, create the partitioned view, Linked Server alias is DB2 and Db3,catalog is TDW (test Data Warehouse).

CREATE TABLE [dbo].[commits](    [Commitid] [bigint] IDENTITY(1,1) not  for REPLICATION  not NULL,    [Authorid] [bigint]  not NULL,    [CreatedDate] [datetime2](7) not NULL,    [Createddatekey] [int]  not NULL, CONSTRAINT [Pk__commits_commitid] PRIMARY KEY CLUSTERED (    [Commitid] ASC,    [Createddatekey] ASC))  on [PRIMARY]GOCREATE View [dbo].[view_commits] asSelect [Commitid]      ,[Authorid]      ,[CreatedDate]      ,[Createddatekey] fromDbo.commits C with(NOLOCK)whereC.[Createddatekey] between 20150900  and 20160000Union  AllSelect [Commitid]      ,[Authorid]      ,[CreatedDate]      ,[Createddatekey] fromDb3.tdw.dbo.commits C with(NOLOCK)whereC.[Createddatekey] between 20150000  and 20150500Union  AllSelect [Commitid]      ,[Authorid]      ,[CreatedDate]      ,[Createddatekey] fromDb2.tdw.dbo.commits C with(NOLOCK)whereC.[Createddatekey] between 20150500  and 20150900 with Check OPTION;GO

2, query performance test

Test1, using the basic table test, cost:16s

Select Count (0)  from dbo.commits_total C with  (nolock)whereDay (c.[ CreatedDate ])=1

Test2, using partitioned view test, cost=136s, with Test1 there is a significant gap.

Select Count (0)  from dbo.view_commits C with  (nolock)whereDay (c.[ CreatedDate ])=1

3, using the OPENQUERY query, OPENQUERY executes the query directly on the linked server, returning the results of the query.

OpenQuery executes the specified pass-through query on the specified linked server.

Select sum(t.cnt) asCNT from(    Select Count(0) asCNT fromDbo.commits C with(NOLOCK)where  Day(c.[CreatedDate])=1    UNION  All    Selectp.cnt from OpenQuery(DB2, N'Select COUNT (0) as CNT from dbo.commits C with (NOLOCK) where Day (C.[createddate]) =1') asPUNION  All    Selectp.cnt from OpenQuery(DB3, N'Select COUNT (0) as CNT from dbo.commits C with (NOLOCK) where Day (C.[createddate]) =1') asp) asT

Cost:106s, it's still very high.

Reference doc:

Top 3 Performance killers for Linked Server Queries

[Translate]--SQL server 5 performance killers using linked servers

SQL Server distributed Database performance testing

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.