?
Solved

constant scan in execution plan

Posted on 2009-04-13
3
Medium Priority
?
2,113 Views
Last Modified: 2012-05-06
I have found a constant scan in my execution plan. Can someone tell me under what condition a constant scan would happen.
0
Comment
Question by:david_32
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 12

Expert Comment

by:udaya kumar laligondla
ID: 24135890
it looks like you are using GETDATE() function in a insert statement or do you have a partitioned table.
read more at
http://scarydba.wordpress.com/2008/07/01/constant-scan-in-execution-plans/
0
 
LVL 57

Accepted Solution

by:
Raja Jegan R earned 2000 total points
ID: 24136248
Its not that you will obtain a Constant Scan when you use a partitioned table.

From MSDN,

Constant Scan

The Constant Scan logical and physical operator introduces a constant row into a query. It will return either zero or one row, which usually contains no columns. A Compute Scalar operator is often used to add columns to the row produced by a Constant Scan.

When you add a new column to a row / Result set using a Scalar function, then you will have a Constant Scan.

Say you have a function named dbo.format and if you use it in your query like

SELECT col1, col2, dbo.format(col3)
FROM urtable

It will have a constant scan.

Whenever you have a scalar function in your query to return some value, For eg, GETDATE() as mentioned earlier, SUBSTRING, LEN, CONVERT, CAST
You will end up in a constant scan.
0
 

Author Closing Comment

by:david_32
ID: 31569796
thanks
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
There are some very powerful Dynamic Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a di…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question