首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
You are the administrator of a SQL Server 2000 database. Using the default options configures the database. You drop indexes to
You are the administrator of a SQL Server 2000 database. Using the default options configures the database. You drop indexes to
admin
2009-05-19
72
问题
You are the administrator of a SQL Server 2000 database. Using the default options configures the database. You drop indexes to facilitate a large import of data, and rebuild them after the import is complete.
Users report that response times from a stored procedure have become slower. In the stored procedure, you examine the following code.
CREATE PROCEDURE GetCustomer
( @CustomerID Int )
AS
SELECT FirstName, LastName, Address1, Address2, City,
State, Zip, MAX(PurchaseDate) AS LastPurchase
FROM Customers C
JOIN Addresses A ON A.AddressID = C.AddressID
JOIN Purchases P ON P.CustomerID = C.CustomerID
WHERE C.CustomerID = @CustomerID
GROUP BY FirstName, LastName, Address1, Address2, City, State, Zip
You want to improve the performance of the procedure by using the least amount of administrative effort. What should you do?
选项
A、Recompile the stored procedure.
B、Update the database statistics.
C、Check the consistency of the database and repair errors.
D、Create a view and modify the stored procedure to use the view.
答案
A
解析
Explanation: By recompiling the stored procedure SQL Server will create a new execution plan for the statements in the procedure. SQL Server will detect that statistics are not up to date and it will automatically recreate the statistics during this process. The execution plan will be optimized for the current distribution of data in the tables.
Note: Stored procedures can be used to improve database query performance. If these SQL statements and conditional logic are written into a stored procedure, they become part of a single execution plan that is cached on the server. When the database is changed by the addition of new indexes or when data in indexed columns are changed, the original query plans and stored procedures used to access the tables should be reoptimized by recompiling them.
This optimization happens automatically the first time a stored procedure is run after SQL Server 2000 is restarted. It also occurs if an underlying table used by the stored procedure changes. But if a new index is added from which the stored procedure might benefit, optimization does not automatically occur until the next time the stored procedure is run after SQL Server is restarted. The stored procedure can be manually recompiled by using the sp_recompile system stored procedure. This forces the stored procedure to be recompiled the next time it is run.
Incorrect Answers:
B: SQL Server detects whether statistics are not up-to-date, and by default it automatically updates them during query optimization. By recompiling the query the statistics will automatically be updated.
Note: SQL Server keeps statistics about the distribution of the key values in each index and uses these statistics to determine which index(es) to use in query processing. Query optimization depends on the accuracy of the distribution steps. If there is significant change in the key values in the index, or if a large amount of data in an indexed column has been added, changed, or removed, or the table has been truncated and then repopulated, UPDATE STATISTICS should be rerun.
C: Consistency of a database is maintained through the use of constraints and triggers. These
mechanisms are used to ensure that the database remains consistent by controlling the type of data that can be inserted into a column, through referential integrity checks, and through cascading referential constraints.
D: A view is a virtual table that can be used to restrict users access to the base table, or to join various base tables so that they appear as a single table. However, creating a view that the stored procedure must access would require the creation of indexes on the view and will have to be updated when the base tables are updates. This would require greater administrative effort.
转载请注明原文地址:https://kaotiyun.com/show/RuhZ777K
本试题收录于:
微软70228题库微软认证分类
0
微软70228
微软认证
相关试题推荐
[A]Marketforglasscraftsisgrowing[B]Dependenceofcomputerdevelopmentonglass[C]Behindtheadaptabilityofglass[D]
[A]Marketforglasscraftsisgrowing[B]Dependenceofcomputerdevelopmentonglass[C]Behindtheadaptabilityofglass[D]
[A]Enduringproblemssuchaswar,poverty,andviolenceultimatelyspringfromhumannature,whichnotechnologicalinnovation
Writealettertooneofyourfriends,apologizingtohim/herforyourmakinghis/hercomputerstopworking.Youshouldwrite
Inthissection,youareaskedtowriteanessaybasedonthefollowinginformation.Makecommentsandexpressyourownopinion.
TheBestMediatoUseThereareplentyofoptionsavailableforspreadingnews,suchasnewspapers,radio,TV,theInternet
Directions:Inthissection,youareaskedtowriteanessaybasedonthefollowinginformation.Makecommentsandexpressy
Writeane-mailofabout100wordstoaforeignteacherinyourcollege,invitinghim/hertobeajudgefortheupcomingEnglish
Writealettertorecommendyourstudent,LiXu,forapositionofadministratorinacompany.Youshouldincludethedetailsyo
Thefollowingscenariowillbeusedforquestions29and30.Johnisanetworkadministratorandhasbeentoldbyoneofhisnet
随机试题
根据《建设工程安全生产管理条例》的规定,出租的机械设备和施工机具及配件,应当具有()。
背景北方工程公司施工总承包了一项大型钢厂工程项目,工程范围包括土建工程、机械设备安装工程、蒸汽排风机安装工程、电气安装工程、自动化安装工程等。由于工期较紧,项目部编制了施工组织设计,对工程进度、质量、安全和文明施工管理进行了重点控制。施工过程中,
近年来,剧场、龟影院、礼堂成了火灾发生的频繁区域,那么当这些建筑设置在耐火等级为一、二级的多层民用建筑内时,应采用耐火极限不低于()h的防火隔墙和甲级防火门与其他区域分隔。
配送中心的功能现在也有分工越来越细的趋势,设施设备的配置除了要考虑需求外,还要考虑物流作业规模及作业批量等因素。()
孙中山的新三民主义与中共的革命纲领有原则性区别的根本原因是他们的()。
犯罪未遂,是已经着手实施犯罪,由于犯罪分子意志以外的原因而未得逞。根据以上定义,下列哪种情况属于犯罪未遂?()
阅读以下史料,并回答问题:大农上盐铁丞孔仅、咸阳言:“山海,天地之藏也,皆宜属少府,陛下不私,以属大农佐赋。愿募民自给费,因官器作煮盐,官与牢盆。浮食奇民欲擅管山海之货,以致富羡,役利细民。其沮事之议,不可胜听。敢私铸铁器煮盐者,钛左趾,没入其器
撰写实验研究报告需要注意哪些方面?
【B1】【B18】
Ican’tgo—foronething,Ihavenomoney,and______,Ihavetoomuchwork.
最新回复
(
0
)