SQL Server“复杂”概念之理解

来源:互联网 发布:免费销售记账软件 编辑:程序博客网 时间:2024/05/19 15:44

用惯了Oracle的人,接触SQL Server中的概念时,会觉得比较难理解,甚至感觉有点“绕”,这是因为Oracle中将某些其他数据库中存在的概念给简化了,这里就拿两个最常见的概念来举例说明:
1、schema:A schema is a container that holds tables, views, procedures, and so on. It is inside a database, which is inside a server. These entities fit together like nested boxes. The server is the outermost box, and the schema is the innermost box. It holds all of the securables listed below. But it cannot hold another box.
上面“schema”的概念,可以翻译成“模式”,这里说是各种数据库对象的容器,其实,也就是一个数据库对象的逻辑集合,这个概念,不仅仅在SQL Server里有,在其他很多关系库里也有,只不过在Oracle中对这个概念进行了弱化,将模式(schema)与用户(user)设计成了一一对应的模式,很多Oracle用户甚至没有模式的概念,只有用户的概念。而在SQL Server里,模式和用户是两个分离的概念,模式是数据对象的容器,而用户是访问数据库的方式和途径,用户可以拥有模式,模式也可以与用户分离,在用户间转换,甚至游离于任何数据库用户。SQL Server中文联机文档里,将schema翻译为架构,大家知道是一回事儿就可以。
2、logical Operators和physical Operators
1)Logical Operators:Logical operators describe the relational algebraic operation used to process a statement. In other words, logical operators describe conceptually what operation needs to be performed.
2)Physical Operators:Physical operators implement the operation described by logical operators. Each of the physical operators is an object or routine that performs an operation. For example, some physical operators access columns or rows from a table, index or view. Other physical operators perform other types of operations: The Aggregate operator calculates an expression containing MIN, MAX, SUM, COUNT or AVG, and the Merge Join operator performs different types of logical join operations.
这里讲的逻辑操作(logical Operators)和物理操作(physical Operators)是指SQL语句执行计划中的各个操作,这点SQL Server有点特殊,非得把执行计划的一个步骤分为逻辑操作和物理操作,前者是逻辑概念,后者是前者的具体选择和实现,这点来说,Oracle更简单些,执行计划中直接给出了具体的操作,也就是这里的物理操作,没有明确逻辑操作的概念,其他数据库中,记得也没有这层概念(记得是这样,但不是很确定),感觉多个逻辑概念有点“多余”,也许是微软想让大家阅读分析执行计划时,给大家一个对每个步骤中操作的概念吧。
从以上两点来看,SQL Server中的概念一般分的更细致,层级更多,各个概念之间也分离的更加清晰,但对用惯了Oracle等其他数据库的用户来讲,开始可能要多适应和理解这点了。

阅读全文
0 0
原创粉丝点击