首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
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
30
问题
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
微软认证
相关试题推荐
Severaltypesoffinancialriskareencounteredininternationalmarketing;themajorproblemsincludecommercial,political,an
[A]Butworkisunderwaytogetcomputerstocapturehumanlifeandrememberitaspeopledo—recallingbitsofexperiencethata
[A]Enduringproblemssuchaswar,poverty,andviolenceultimatelyspringfromhumannature,whichnotechnologicalinnovation
AlmosteveryyearsincetheendofthefinancialcrisishasstartedwithrosyexpectationsamongAmericanforecasters,andthis
MenorcaorMajorca?Itisthattimeoftheyearagain.Thebrochuresarepilingupintravelagentswhilenewspapersandmagazin
MenorcaorMajorca?Itisthattimeoftheyearagain.Thebrochuresarepilingupintravelagentswhilenewspapersandmagazin
Adealisadeal—except,apparently,whenEntergyisinvolved.Thecompany,amajorenergysupplierinNewEngland,provokedjus
GivingmillionsofexistingPayPalcustomerstheabilitytobuyattheclickofabuttonhasenormouspotentialforincreasing
设置网络打印机,不允许每个连接到该计算机的用户都使用该网络打印机,只允许用户Administrators和Powerusers使用本地打印机。
Guest账户和Administrator账户一样是由系统建立的,不能被禁用。
随机试题
有关降钙素的临床应用哪个不正确
关于船舶担保物权及针对船舶的请求权的表述,下列哪些选项是正确的?(2012年卷三第76题)
投资者对房地产内部使用功能的变动,体现了投资者对房地产投资()的重视。
某加油站拟进行储罐改造,将油罐由加油站房后方移到罩棚车道下。目前该项目安全设施设计专篇已完成,随后该单位收集整理相关资料,组卷上报当地安全生产监督管理部门,提出审查申请。安全监管部门资料接收人员对该加油站报送的资料进行了初审,并退回了无须上报的资料。下列资
张某因闯红灯被公安机关处以罚款处罚,该处罚性质属于:
在我国教育史上,最早把小学教育规定为义务教育是在()。
主题是公园的文化与灵魂。然而国内的主题公园,往往是跟风的产物,落地之前缺乏足够的文化_______,落地之后少了一份文化_______,吸引顾客的大多是高科技的新鲜劲,或是宣传的噱头,这些恐怕很难吸引回头客。填入划横线部分最恰当的一项是:
消极完美主义者总是非常仔细地检查任何事情的细枝末节,有时竟达到__________的地步。他们缺少一种适时放弃的智慧,他们所追求的“完美”,不是美学意义上的“完美”,而是一种非常刻板而教条式的“完美”。填入画横线部分最恰当的一项是()。
中华人民共和国成立后,从1949年到1956年的历史发展阶段属于()。
Forthispart,youareallowed30minutestowriteacompositiononthetopicStudentsComplaints.Youshouldwriteatleast120
最新回复
(
0
)