Solved

constant scan in execution plan

Posted on 2009-04-13
3
1,997 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
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 500 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

726 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