首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
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
36
问题
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://jikaoti.com/ti/fwO7FFFM
本试题收录于:
微软70228题库微软认证分类
0
微软70228
微软认证
相关试题推荐
[A]Thefirststepinpreparingamarketingplanisthatofproducingtheinformationnecessaryfordecision-making.Usually,a
Severaltypesoffinancialriskareencounteredininternationalmarketing;themajorproblemsincludecommercial,political,an
WhentheresidentsofBuenosAireswanttochangethepesostheydonottrustintothedollarstheydo,theygotoacueva,or"
TheUniversityNewspaperisrecruitingsomejournalists.WriteamemoonJune1,2009toallstudents,explaining1)therequirem
SupposeyouphonedyourfriendMaryseveraltimesyesterdaybutshedidn’tansweryourcallatall.Writeheranemailto1
Herearesomemanagementtoolsthatcanbeusedtohelpyouleadapurposefullife.1.UseYourResourcesWisely.Yourdecisi
Itstartedsmall.Justapoliticalslogan,pastedontoaposterinabackofficesomewhere;NOEUROin1999.Germany’smainoppo
TheU.S.PostalService(USPS)continuestobleedredink.Itreportedanetlossof$5.6billionforfiscal2016,the10thst
InParagraphs1and2,thetextshowsPTK’s______.Skepticalobserversbelievethatancestrytestingfailsto______.
设置网络打印机,不允许每个连接到该计算机的用户都使用该网络打印机,只允许用户Administrators和Powerusers使用本地打印机。
随机试题
下列说法中错误的是()。
A.脊神经节B.后角C.白质D.前角E.侧角含有感觉神经元胞体的是()
在防止矽尘的工艺过程中,能根本消除粉尘危害的是
我国北方某受冻区海港,实测的高、低潮位与累积频率的关系如表1、表2所列。该海港码头水位变动区的范围是()。
划分税目的主要目的是( )。
山西某联合企业为增值税一般纳税人,2018年8月生产经营情况如下:(1)专门开采的天然气45000千立方米,开采原煤450万吨。(2)销售原煤280万吨,取得不含税销售额22400万元。(3)以原煤直接加工洗煤110万吨,并且
陈某,46岁,2018年5月与某机械没备公司签订了为期三年的劳动合同,约定从事清洁工作。2019年10月,该公司人事部门将陈某调至车间做数控车工。陈某不同意公司改变约定的劳动条件,而公司则要求陈某服从安排,双方发生纠纷。根据《劳动合同法》,关于解决双方纠纷
亚洲金融危机的爆发深刻暴露了亚洲各国在协调经济政策、共同______危机方面的苍白无力。一种流行的观点认为,正是由于亚洲各国存在着经济与社会发展方面的差异性、多样性和文化的多元性,缺少一种强有力的______力量,才使亚洲各国在金融危机中吃尽苦头,元气
以下选项中可以作为保证人的是()。
在我国,法律适用过程中较少使用归纳推理的直接原因是()。
最新回复
(
0
)