为了获得更快的减法? [英] For acquire a subtraction which is faster ?

查看:86
本文介绍了为了获得更快的减法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

获取更快的减法?

1.向SQL数据库发送两个查询并获取两个整数数据,然后:减法=(查询结果1 - 查询结果2)

2-写一个减法查询,如:

For acquire a subtraction which is faster ?
1.Send two queries to SQL database and get two integer data,then : subtraction = (result of query 1 - result of query 2 )
2- Write a subtractions query like :

select (A)-(B) from Database_name1 inner join Database_name2 on key1=key2 where conditions 

发送到数据库并获得直接结果



简单查询和连接查询之间有区别吗?

----------------------

其他信息:



SQL Server 2012

Visual Studio 2012(.Net 4及更高版本)

C#environment

Send to Database and get a Direct result

Is there a difference between a simple query and a join query ?
----------------------
Additional Info :

SQL Server 2012
Visual Studio 2012 (.Net 4 and higher)
C# environment

推荐答案

单个查询应该更快:SQL非常高效,它可以节省网络通信这可能是这里的瓶颈。



但是为什么不尝试看看呢?使用秒表类,每次操作重复10,000次。最快的是胜利者......
Single query should be quicker: SQL is pretty efficient and it saves the network communications which are likely to be the bottleneck here.

But instead of asking questions like this, why not try it and see? Use the Stopwatch class and time 10,000 repeats of each operation. the quickest one is the winner...


这篇关于为了获得更快的减法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆