Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Query Execution Plan

Author  Topic 

Sarat
Constraint Violating Yak Guru

265 Posts

Posted - 2002-11-21 : 11:44:38
Hi,
I am confused by the statement on books online:
--
The algorithms to match new SQL statements to existing, unused execution plans in the cache require that all object references be fully qualified. For example, the first of these SELECT statements is not matched with an existing plan, and the second is matched:
1.
SELECT * FROM Employees
2.
SELECT * FROM Northwind.dbo.Employees
--
Q1.
What does he mean by UNUSED execution plan (When the query is run only once?)?

Q2.
I never use fully qualified name so if I do in this way (see below), is SQL Server not using execution plan from cache when I query the second time?

1.
SELECT * FROM Employees

2.
SELECT * FROM Employees

Q3.
Can I look somewhere (or where is the algorithm) to see if a query execution plan exits for a query apart from guessing by time taken to return results?

Thanks,
Sarat.

nr
SQLTeam MVY

12543 Posts

Posted - 2002-11-21 : 12:24:57
I guess it is saying that whenever you execute a query the plan will be saved in cache (until purged of course).
If you type in the same query again it can use the same plan if it can match it - but it will only match on fully qualified names.

This will not affect stored procedures - only ad hoc queries which you probably don't worry about.

You probably won't notice the time taken to generate the plan for most ad hoc queries.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -