Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How to FInd Actual Row Count


How to FInd Actual Row Count

Author
Message
New2SQL-343122
New2SQL-343122
Valued Member
Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)

Group: General Forum Members
Points: 53 Visits: 1027
Hi,

From the Below Script, how to find Actual row count at Step 4 & Step 5.

Basially, need to validated between Index Scan and Index Seek.

Using SQL Server 2000.

/* Script Begin */

Step 1 :
Create table T1 (id int, name varchar(10))

Step 2 :
declare @rows int, @name varchar(3)
set @rows = ascii('A')
while (@rows <= ascii('Z'))
begin
set @name = char(@rows) + char(@rows) + char(@rows)
insert into T1 values (@rows, @Name)
set @rows = @rows + 1
end

Step 3 :
-- Table Scan will appear when no Index exists
SET STATISTICS XML OFF
select * from T1

Step 4 :
-- Creating Clustered index on ID Column to appear Index Scan while searching for Name Field
Create Clustered index IX_ID on T1(ID)
go
select * from T1 (nolock) where Name = 'BBB'
-- Question : In this Stage, technically I want to prove how many records were scanned in the table T1 ( Acutal Row Count ).
-- This is not appearing in the Execution Plan ( Acutual Row Count ) using SQL Server 2000

Step 5 :

-- Creating NonClustered index on Name Column to appear Index Seek while searching for Name Field
Create NonClustered index IX_Name on T1(Name)
go
select * from T1(nolock) where Name = 'BBB'
-- How to technically prove to others that Index Seek touching one record from the Table T1 and Index Scan touching all the records as step 4

/* Script End */
ChrisM@Work
ChrisM@Work
SSCrazy Eights
SSCrazy Eights (8.9K reputation)SSCrazy Eights (8.9K reputation)SSCrazy Eights (8.9K reputation)SSCrazy Eights (8.9K reputation)SSCrazy Eights (8.9K reputation)SSCrazy Eights (8.9K reputation)SSCrazy Eights (8.9K reputation)SSCrazy Eights (8.9K reputation)

Group: General Forum Members
Points: 8935 Visits: 19009
New2SQL-343122 (6/27/2012)
Hi,

From the Below Script, how to find Actual row count at Step 4 & Step 5.

Basially, need to validated between Index Scan and Index Seek.

Using SQL Server 2000.

/* Script Begin */

Step 1 :
Create table T1 (id int, name varchar(10))

Step 2 :
declare @rows int, @name varchar(3)
set @rows = ascii('A')
while (@rows <= ascii('Z'))
begin
set @name = char(@rows) + char(@rows) + char(@rows)
insert into T1 values (@rows, @Name)
set @rows = @rows + 1
end

Step 3 :
-- Table Scan will appear when no Index exists
SET STATISTICS XML OFF
select * from T1

Step 4 :
-- Creating Clustered index on ID Column to appear Index Scan while searching for Name Field
Create Clustered index IX_ID on T1(ID)
go
select * from T1 (nolock) where Name = 'BBB'
-- Question : In this Stage, technically I want to prove how many records were scanned in the table T1 ( Acutal Row Count ).
-- This is not appearing in the Execution Plan ( Acutual Row Count ) using SQL Server 2000

Step 5 :

-- Creating NonClustered index on Name Column to appear Index Seek while searching for Name Field
Create NonClustered index IX_Name on T1(Name)
go
select * from T1(nolock) where Name = 'BBB'
-- How to technically prove to others that Index Seek touching one record from the Table T1 and Index Scan touching all the records as step 4

/* Script End */


"Records" aren't scanned - pages are.
AFAIK there's no record of the number of pages scanned by an operator. Actual Row Count is the number of rows returned by the operator.

“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Exploring Recursive CTEs by Example Dwain Camps
New2SQL-343122
New2SQL-343122
Valued Member
Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)

Group: General Forum Members
Points: 53 Visits: 1027
Thanks for Reply,

My Question is how to find the Actual Row Count and where it will show me the acutal row count likewise Estimated Row Count in the Execution Plan by the time when Index Scan Influenced.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search