Solved

constant scan in execution plan

Posted on 2009-04-13
3
1,864 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:udayakumarlm
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now