我只是想知道进行多选与使用单选之间有什么区别,是否有任何性能提升?我看到有人这样做了,我觉得它有点失控,如下所示;
select @a = cBranchName from mstores where nBranchCode = 1
select @b = cBranchAddress from mstores where nBranchCode = 1
select @c = dCreateDate from mstores where nBranchCode = 1
select @d = AssignedCompanyId from mstores where nBranchCode = 1
select @e = StoreFormat from mstores where nBranchCode = 1
对比
select @a = cBranchName
,@b = cBranchAddress
,@c = dCreateDate
,@d = AssignedCompanyId
,@e = StoreFormat from mstores where nBranchCode = 1
我还假设5个select对数据库进行了5次访问,我如何证明单个select语句比5个select语句快,
即使只看它,我已经认为单选语句比多选快得多。