SQL Server????????????????
???????????? ???????[ 2016/6/24 13:52:51 ] ????????SQL server ??????? ?????
????3?????OpenQuery?????OpenQuery?????????????Linked Server????У?????????????
OpenQuery Executes the specified pass-through query on the specified linked server.
select sum(t.cnt) as cnt
from
(
select count(0) as cnt
from dbo.commits c with(nolock)
where day(c.[CreatedDate])=1
UNION all
select p.cnt
from openquery(db2??
N'select count(0) as cnt
from dbo.commits c with(nolock)
where day(c.[CreatedDate])=1') as p
UNION all
select p.cnt
from openquery(db3??
N'select count(0) as cnt
from dbo.commits c with(nolock)
where day(c.[CreatedDate])=1') as p
) as t
cost:105s????????.
????4?????C# ????????????????Task???????????Server???Cost??28s
static void Main(string[] args)
{
List<Task> tasks = new List<Task>();
int c1=0?? c2=0?? c3=0;
Task t1 = new Task(()=>
{
c1= GetCount("xxx");
});
Task t2 = new Task(() =>
{
c2= GetCount("xxx");
});
Task t3 = new Task(() =>
{
c3= GetCount("xxx");
});
tasks.Add(t1);
tasks.Add(t2);
tasks.Add(t3);
Stopwatch sw = new Stopwatch();
sw.Start();
t1.Start();
t2.Start();
t3.Start();
Task.WaitAll(tasks.ToArray());
int sum = c1 + c2 + c3;
sw.Stop();
Console.Read();
}
static int GetCount(string str)
{
using (SqlConnection con = new SqlConnection(str))
{
con.Open();
var cmd = con.CreateCommand();
cmd.CommandText = @" select count(0) as cnt
from dbo.commits c with(nolock)
where day(c.[CreatedDate]) = 1";
int count = (int)cmd.ExecuteScalar();
con.Close();
return count;
}
}
????5??????
????· ?????????з????????????????SQL Server?????????????????????DB??????á?
????· ???OpenQuery??????????????Remote Server????У??????????????????Linked Server ?????????
????· ????÷???????????????????????????????д?????????????fore-end ????????
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
??????????????????????????????????APP?????????????????????????????????????????SQL??????????????Щ????????????????????????????????????????????????????????????????????????Web????????????????????????????????????????????????????漰????????????????????????????????Java???????????Щ??????????????????????????????????????????????????????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????