首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
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
41
问题
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
Ofallthegoodsandservicestradedinthemarketeconomy,pharmaceuticalsareperhapsthemostcontentious.Thoughproducedby
Imaginativeworkssuchasnovels,plays,films,fairytales,andlegendspresentamoreaccurateandmeaningfulpictureofhuman
Writealettertooneofyourfriends,apologizingtohim/herforyourmakinghis/hercomputerstopworking.Youshouldwrite
Inthissection,youareaskedtowriteanessaybasedonthefollowinginformation.Makecommentsandexpressyourownopinion.
EricHansenwritesabouttravelasaparticipatingenthusiastratherthanamereobserver.【T1】Itgivesthesenineessays,based
In2016,manyshoppersoptedtoavoidthefreneticcrowdsanddotheirholidayshoppingfromthecomfortoftheircomputer.But
LastThursday,theFrenchSenatepassedadigitalservicestax,whichwouldimposeanentirelynewtaxonlargemultinationalst
NextmonthBritonswillhaveyetmoresmartphonestochoosefrom,whendevicesfromWiko,atwo-year-oldFrenchcompany,goons
Bobisanewsecurityadministratoratafinancialinstitution.Theorganizationhasexperiencedsomesuspiciousactivityonone
随机试题
A.凹肚脐B.凹窝C.五花层D.有油条E.皮刺杭麦冬药材久置或经夏后色渐转红的现象是
引起牙齿松动(病理性)的最主要疾病为
患者男性,56岁,心脏骤停后出现心室颤动,电击后仍没有好转,应首选的治疗药物是
患者,男,55岁。反复餐前上腹隐痛15年,近10天来上腹胀满不适,恶心、呕吐,大量呕吐后症状可缓解.呕吐物含有发酵酸性宿食。可能的诊断为
能直接将两种材料牢固地黏结在一起的物质通称为胶粘剂,它不必具备何种性能?[1998年第020题]
我国法学界一般认为,建设工程招标是()。
简述结账有哪些程序。
(2017年济宁汶上)古代教育的一般组织形式足()
毛泽东指出:人民这个概念在不同的国家和各个国家的不同历史时期,有着不同的内容。在当代中国,一切赞成、支持和参加中国特色社会主义建设的阶级、阶层和社会力量,都属于人民的范畴,都是建设中国特色社会主义事业的依靠力量。其中,建设中同特色社会主义事业的根本力量是(
王某是甲公司的法定代表人,以甲公司名义向乙公司发出书面要约,愿以10万元价格出售甲公司的一块清代翡翠。王某在函件发出后2小时意外死亡,乙公司回函表示愿意以该价格购买。甲公司新任法定代表人以王某死亡,且未经董事会同意为由拒绝。关于该要约,下列哪一表述是正确的
最新回复
(
0
)