首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
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
35
问题
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]Thefirststepinpreparingamarketingplanisthatofproducingtheinformationnecessaryfordecision-making.Usually,a
[A]Enduringproblemssuchaswar,poverty,andviolenceultimatelyspringfromhumannature,whichnotechnologicalinnovation
Writeanessayof160~200wordsbasedonthefollowingdrawing.Inyouressay,youshould1)describethedrawingbriefly,
Herearesomemanagementtoolsthatcanbeusedtohelpyouleadapurposefullife.1.UseYourResourcesWisely.Yourdecisi
"Thisisareallyexcitingtime—aneweraisstarting,"saysPeterBazalgette,thechiefcreativeofficerofEndemol,thetelev
Evenintraditionaloffices,"thelinguafrancaofcorporateAmericahasgottenmuchmoreemotionalandmuchmoreright-brained
Adealisadeal—except,apparently,whenEntergyisinvolved.Thecompany,amajorenergysupplierinNewEngland,provokedjus
Notlongago,chiefexecutiveofficers(CEOS)werelandedasheroes,leadersofthebraveneweconomy.BillGatesandJackWelchw
Notlongago,chiefexecutiveofficers(CEOS)werelandedasheroes,leadersofthebraveneweconomy.BillGatesandJackWelchw
Emilyislisteningtonetworktrafficandcapturingpasswordsastheyaresenttotheauthenticationserver.Sheplanstouseth
随机试题
手术病人一般在术前6~12小时开始禁食是因为
某建成于1998年5月末的临街商住两用商品房,共6层,一层为商业用房,为钢筋混凝土框架结构;其余各层均为住宅,为砖混结构。据了解,近几年来不少产权人对自己拥有的房屋进行出租和出售。若居住用地面积为14hm2,住宅用地面积为10hm2,其中高层建筑面积3
工程分析一般采用类比分析法、()、资料查阅分析法。
会计主体从()上对会计核算范围进行了有效界定。
甲公司和乙公司均为增值税一般纳税人,适用的增值税税率均为17%。有关债务重组和资产置换业务资料如下:(1)2015年2月1日,乙公司销售一批商品给甲公司,购货款及税款合计700万元。8月15日款项到期,由于甲公司发生财务困难,不能按合同规定支付货款,20
在幼儿园中,教师要学会与幼儿沟通。比如,要熟记每个幼儿名字,这样幼儿会感到非常亲切,对教师的话作出积极反应;说话的语速和语调要恰当,最好能引发幼儿的好奇心;与幼儿交谈时,语言要简单明确,容易被幼儿接受;说话的态度要友善,比如:“我很喜欢听到你的描述,相信每
下列事实能体现细胞全能性的是()
左图为某一零件的立体图形,右边哪一项不属于该立体图形的截面图?
简述国际收支失衡的调节措施。
Formorethantwodecades,U.S.courtshavebeenlimitingaffirmative-actionprogramsinuniversitiesandotherareas.Thelegal
最新回复
(
0
)