Understanding Statistics io and Logical reads - is logical reads information correct

Hi,
This question arises during a performance test - on SQL Server 2012 with SP2.
In the following example, table has only column and that is of data type INT.
When inserted 592 records of data type INT it is doing only 1 logical read but as soon another record is inserted SP is reporting 2 logical reads. Why?
In the code, i have highlighted difference between 
statistics io - logical reads and sys.dm_exec_procedure_stats.total_logical_reads
to understand the difference between these 2 information.
set nocount on
GO
create table dbo.test_storage_and_logical_reads
employee_number int --primary key
GO
go
CREATE procedure dbo.test_sp_logical_reads
as
begin
select
employee_number
from dbo.test_storage_and_logical_reads
order by employee_number desc
end
go
insert into dbo.test_storage_and_logical_reads
(employee_number)
VALUES (1)
GO 592
EXEC sp_spaceused 'dbo.test_storage_and_logical_reads'
--set statistics io on
--GO
exec dbo.test_sp_logical_reads
GO
----Table 'test_storage_and_logical_reads'. Scan count 1, logical reads 1, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
---- But sys.dm_exec_procedure_stats.total_logical_reads is reporting 3 instead.
truncate table dbo.test_storage_and_logical_reads
GO
insert into dbo.test_storage_and_logical_reads
(employee_number)
VALUES (1)
GO 593
EXEC sp_spaceused 'dbo.test_storage_and_logical_reads'
exec dbo.test_sp_logical_reads
GO
----Table 'test_storage_and_logical_reads'. Scan count 1, logical reads 2, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
---- But sys.dm_exec_procedure_stats.total_logical_reads is reporting 4 instead.
--drop procedure dbo.test_sp_logical_reads
--drop table dbo.test_storage_and_logical_reads
GO
NB: I do understand the logical and physical reads. Thanks.
For quick review of new features, try virtual labs: http://msdn.microsoft.com/en-us/aa570323

Hi.
I still need to test the scenario but if you read definition of this DMV it says 'Returns aggregate performance statistics for cached stored procedures' so I guess, I am not sure 3 can be due to this aggregated output given by this DMV. Will test it
on SS 2012 SP2 will get back to you.
Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it.
My TechNet Wiki Articles
Hi Shanky / Sean Gallardy
i think Sean Gallardy created the "test_sp_logical_reads" table in master DB, i have that same issue when i accidentiatly created the table "test_sp_logical_reads" in master, but when i create the same table in USER DB like "sample1"
it only allocate 1 page for 592,
hi Asam,
Let me narrow down the your question, if my understanding is correct ...
<<When you have the free space in a page of a Heap, why SQL Server is assigning New page for a New Record>>
Answer is in PFS bytes
The answer is that PFS bytes are not fully reset until the page is reallocated. On deallocation, the only bit in the PFS byte that's changed is the allocation status bit - this makes it very easy to rollback a deallocation
--Before inserting the 593 record plese execute the below query
--Note Replace "database1" with your DBName
DBCC TRACEON (3604);
DBCC IND ('database1', 'test_storage_and_logical_reads', 1);
--Result
PageFID PagePID IAMFID IAMPID ObjectID IndexID PartitionNumber PartitionID iam_chain_type PageType IndexLevel NextPageFID NextPagePID PrevPageFID PrevPagePID
1 2770 NULL NULL 517576882 0 1 72057594039828480 In-row data 10 NULL 0 0 0 0
1 2769 1 2770 517576882 0 1 72057594039828480 In-row data 1 0 0 0 0 0
--your intrested in the second record(page)
DBCC PAGE ('database1', 1, 2769,3) WITH TABLERESULTS;
--you can find 38th row as
--PFS (1:1) = 0x64 MIXED_EXT ALLOCATED 100_PCT_FULL
--which means your page is full
--you can try inserting 300 rows it will show you PFS (1:1) = 0x61 MIXED_EXT ALLOCATED 50_PCT_FULL
please refer in the below link
http://blogs.msdn.com/b/sqlserverstorageengine/archive/2006/07/08/under-the-covers-gam-sgam-and-pfs-pages.aspx
http://aboutsqlserver.com/2013/12/17/sql-server-storage-engine-heap-tables/
"This page has a PFS byte value of 0x04 - how can it be full when its not allocated?"
The answer is that PFS bytes are not fully reset until the page is reallocated. On deallocation, the only bit in the PFS byte that's changed is the allocation status bit - this makes it very easy to rollback a deallocation.
Here's an example. Using a database with a simple table with one row.
A DBCC PAGE of the IAM page includes:
PFS (1:1) = 0x70 IAM_PG MIXED_EXT ALLOCATED 0_PCT_FULL
If I run the following:
BEGIN
TRANSACTION
DROP
TABLE T1
GO
And then do the DBCC PAGE again, the output now includes:
PFS (1:1) = 0x30 IAM_PG MIXED_EXT 0_PCT_FULL
And if I rollback then transaction, the DBCC PAGE output reverts to:
PFS (1:1) = 0x70 IAM_PG MIXED_EXT ALLOCATED 0_PCT_FULL
Thanks
Saravana Kumar C

Similar Messages

  • Keep getting message pop up "Error reading/writing file  "com.apple.logic.pro.cs": Logical end-of-file reached during read operation," and "The Preferences are not loaded completely. Save them to "com.apple.logic.pro.cs" anyway?" Using Logic pro 8. ???

    Logic froze while I was working on something so I forced quit.  Now every time I open LOGIC a message pops up that says:
    "Error reading/writing file
    “com.apple.logic.pro.cs”:
    Logical end-of-file reached during read operation."
    The only button option is cancel so I press it and another message appears that says:
    "The Preferences are not loaded completely.
    Do not save them, as you would overwrite the Preferences file with incomplete data."
    Then when i close logic a box appears saying:
    "The Preferences are not loaded completely.
    Save them to "com.apple.logic.pro.cs" anyway?"
    There are 3 button options to press; ok, cancel or dont save.
    I press "don’t save" cuz I don't want to ruin anything.
    I found a discussion located here: https://discussions.apple.com/message/9564253#9564253 that says if I delete the file "com.apple.logic.pro.cs" it will resolve the problem.  If I do this will I loose or mess anything up at all, automation, saved channel strips customizations, saved effects, synth, or ultrabeat customizations etc? Or especially will I loose any work I've done?  I have hundreds pieces of music files I've created.  I'm scared to mess anything up with all the hours and months of work I've done.  Is there anyway to fix this without loosing anything?  I'm using Logic Pro 8.
    Thank you

    You can safely delete this file - its the preference file for control surface settings - you haven't said whether you're actually using a control surface or not, if so, you will have to set it up again. A new file will be created when you fire Logic up again, but of course it will contain default settings. If you have a complicated control surface setup, remember to keep a backup copy somewhere in case any future problems arise.
    Other than that, you really have nothing to be scared about - hopefully your problem is as simple as that and there isn't an underlying problem (a corrupt hard drive, for example). You seem concerned about losing work, so I guess you want to think about backing that up on a regular basis too. If you're saving your projects to your system drive, do get an external one for this. And also check that you have plent of free space on your system drive - you need to keep about a quarter or third of it free for your OS and programs to run properly (some temporarily stored files can be quite large).

  • Message determination and Partner function LS (Logical system) for PO

    Hi,
    I have worked in the past with vendors (VN) as partner roles in a PO, with the message to create an EDI outpout to Partner Type: LI (Vendor), and this works succesfully.
    Now, the idea was to use in EDI, a Partner Type: LS (Logical system) as a receiver of EDI messages (message types: ORDERS) for inbound Purchase Orders to the Partner.
    So, we have set up a respective message condition, with Partner Function: LS  (Logical System), in transaction: MN04 (Create Output-condition records).
    A. When we use ME59N and create a PO with ref. from a PR (created from a sales order), the message determination works well, it reads the condition set in MN04 (condition records for messages), and creates a message (with output type for EDI , medium: 6, and partner function LS: Logical system). Message is created and idoc is sent to partner.
    B. When we try with ME21N, ME21 and we create the PO with ref. to the same PR, either by entering manually the PR in the document overview of ME21N or by selecting the PR (without entering the PR number), i.e with date, the message is not created in the PO.
    Company code is assigned to purchase organization, and so is purchase organization to plant.
    Any idea why there is no automatic message determination in the case of the transaction: ME21N?
    There is a single message condition that is to be read for both cases (trans: ME59N and ME21N).
    Note: If I try ME21N, and enter the output type and partner (=Logical System), manually, I receive a warning message :
    VN006 (Partner XXXX does not exist for partner function LS). If I accept this warning message, then message is saved- idoc is sent.
    However you can not assign a partner function LS to a vendor, in vendor master data, because of message CZ 327 (Can not use this partner role).
    Anyone with similar experience? Thank you for your advice.

    Hi,
    I well understand that the receiving partner can be a partner: Vendor (LI).
    I have seen that working.
    However, in the Partner Profiles (trans: WE20), the receiver was created as a Logical System (LS).
    We want the partner Logical system (LS) to receive the idoc for purchase order (ORDERS).
    After that, I think that the idea is that the LS can generate an idoc for a sales order creation that will then outbound to another partner.  I think that this is the concept.
    The issue is that I have seen that the POs created with transaction: ME59N, have received from message determination (trans: MN04) the message with partner LS (automatically), and the idoc of the purchase order (ORDERS) have reached the partner LS.
    The question is why the message determination fails when creating the PO from trans: ME21N or ME21, with reference to the PR. Message condition is the same and message determination procedure is the same for both cases.
    There is no issue with customizing for the LS in trans: WE20
    (Port processing agent is Active for LS and ORDERS have the proper processing code for application EF).
    I hope I am helping more with this.

  • I need help I have the m audio m track plus and working out of logic studio 9 and it comes up but I have no sound, but I can here it using garageband. How do I get it to work with logic studio?

    How do I use my M Audio M track Plus with the logic pro 9 software? It works with garageband, but I am not getting anything out of Logic. It does show up on list as option and I have done all of the sound preferences to M audio, etc. etc. Please help

    I got to that page but clicking on the Subscribe Free had no effect.
    Nothing showed in the Podcasts nor the iTunes U.
    In fact I also subscribed to Stanford's lectures and despite actually managing to DL them there is still no subscription in iTunes U, just the Intro to Computer Science belatedly.
    Peter
    I'd like to attach the screen grab of the out of order and randomly DLed selection of Harvard's course, but the forum won't let me attach it even though it is only 456k. Correction, close post and retry and now it lets me. NB how intermittent the DLs are and in no particular order.

  • Logic express and pro 7 to logic studio 9 upgrade question

    I have logic express 7, logic studio 7, and just upgraded to logicstudio 9, but my serial number is not recognized. All my copies should be registered with apple already, so how should i best remedy this?

    Hi again and thanks for the reply.
    I tried to follow your instructions but isn't working still. I think I did something wrong. Here is what I did:
    1. Went to Midi Setup, double clicked on IAC driver and then checked the "device is online" box. It says its on Bus 1.
    2a. In pro tools, went to peripherals, at the synchronization tab I left MTC reader port: ANY and put MTC Generator Port: IAC Driver, Bus 1
    2b. Then went to the Machine Control tab, enabled MIDI Machine Control and set it to IAC Driver, Bus 1.
    3a. In Logic Express I went to preferences>Midi>Sync and selected listen to MMC Input and took Midi Clock off. I see where it says MTC but there isn't a place to make it the slave.
    I know I'm not doing this right because I hit play on Pro Tools and Logic Express just laughs at me
    Can you help me through this. I'm a novice with Macs and Syncing.
    Thanks again friend.
    Josh
    Mac Pro Mac OS X (10.4.8)
    Mac Pro   Mac OS X (10.4.8)  

  • I have OS X 10.9 and have just got logic

    have OS X 10.9 and have just got logic and ive instaled the disk and read through all the instructions and now it wont let me open logic with OS X 10.9 ? is their any way to sort this out or to somehow get OS X 10.6 ? ive used time machine and it doesnt go back far enough

    It would help if you'd let us know which version of Logic you have. 
    My first suggestion would be to check Software Update after installing Logic to make sure you have the latest update for your version.  For example, if you happen to have Logic Express 9 you should update it to version 9.1.8.

  • Clipping sound and other things with Logic X 10.0.6

    Hi 2 everyones, I notify all about strange things when run Logic X but not only in my new iMac 27" the same in older Mac Pro mid 2008.
    In my Home Studio I use with satisfaction this Mixer with USB 2.0 interface.
    In this early 2014 change my iMac 21,5" (late 2009) with iMac 27" core i7. From start using Logic X, after recording audio track sometimes the sound distorce, clip and sometimes not.
    I’ve try everything (disconnect USB, reset logic,..) but the problem persist.
    And another thing that happen in my iMac and other Mac Pro, when (shift+W) edit the audio file with Soundtrack pro (the first time) try to save and return to logic but STP stall (colored whirl), must use forced escape, than re edit and save normally and come back to Logic.
    When change from Logic to STP (and reverse) notify center tell me that I’ve change my midi interface but the strange thing is that I deactivate notification center in Logic….. Can someone tell me more??
    PS. I read something in this discussion but confusign me too much
    Thanks

    Ok, the first problem was gone when I completely reset PRAM and VRAM.
    But the second is still there. When I open Logic x, and then want to edit externally (with STP) the file (SHIFT+W) edit it and then try to save, STP stall, and I must force quit. Then the second time i re-edit externally the file open it in STP edit, save and that's is fine....why?
    Thanks to all forum

  • I have just bought a 2011 iMac (2.5 ghz, 4gb) and logic express 9, and when i installed logic and tried to run it i had a message saying 'you can't use this version of the application logic express with this version of Mac OS X. How do i sort this out!?

    I have just bought a 2011 iMac (2.5 ghz, 4gb) and logic express 9, and when i installed logic and tried to run it i had a message saying 'you can't use this version of the application logic express with this version of Mac OS X. How do i sort this out!? It is very frustrating as the main reason i have bought  a mac is to use logic! Any help would be great as i am a complete novice when it comes to Macs!

    You're probably on OS X Lion?
    I had the same problem as you. I used Software Update to update Logic Express to the latest version, and then it ran without any problems.

  • [svn:fx-trunk] 11810: Fixing up some logic around pauseWhenHidden ( there were some bugs) and also changing some logic around enabling/ disabling.

    Revision: 11810
    Revision: 11810
    Author:   [email protected]
    Date:     2009-11-13 17:07:56 -0800 (Fri, 13 Nov 2009)
    Log Message:
    Fixing up some logic around pauseWhenHidden (there were some bugs) and also changing some logic around enabling/disabling.  Also fixing a small documentation bug on VideoPlayer2.scaleMode.
    When a video component (or one of its ancestors) becomes disabled, the video pauses.  When it becomes re-enabled, we do not play the video.  This behavior is baked in to VideoDisplay and does not depend on the pauseWhenHidden flag.
    QE notes: -
    Doc notes: -
    Bugs: SDK-24182, SDK-24181, SDK-24193
    Reviewer: Kevin
    Tests run: checkintests
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-24182
        http://bugs.adobe.com/jira/browse/SDK-24181
        http://bugs.adobe.com/jira/browse/SDK-24193
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/VideoDisplay.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/VideoPlayer2.as

    Thanks Erik,
    If nothing else, this huge list of updates and fixes, shows clearly that the Logic Dev team is working hard on fixing and improving LPX to a major degree.... and from the list of fixes done.. show they do read the bug reports submitted!
    As an aside....
    I recall how all the 'naysayers' prior to LPX (and in some cases, since...)  were proclaiming how Logic was dead, the team was being disbanded, we won't see any further development, the Dev team doesn't listen or care... and so on....... I wonder where those people are now?

  • Logical reads VS physical reads

    hello all,
    What is the difference between logical reads and physical read ??? I do get the part of logical read (from buffer) and physical read(from disk). And also do know physical reads are bad, but is it true in oracle world..logical reads are bad ??? if so why ??? Could you please explain which on to look for. As i am going thru AWR report and i see segemts by logical/physical read.

    The first and foremost difference is that physcial reads are done from the hard disk. And this is always going tobe slwoer than the memory. That's why its said that the physcial ios must be removed. Logical ios are good as they are done from the memory.The theory that logical are also not good is because the logical ios require the access given by latches. So with lots of the gets for the latches put them in to contention and latch contention would make the access to the logical io slower.So its better to do this in less IO even they are logical too.
    Lots of logical IOs probably mean that you are accessing unnecessary data which may be not required.
    HTH
    Aman....

  • I purchased a powermac pro and it came with logic Pro 9 (but with out the additional suite of programs that comes with). How can I reregister or reinstall Logic Pro 9 to get those features?

    I could really use some insight into this please also how many gigs of RAM should my power mac have it only has two right now and logic tends to glitch up majorly.

    My original question :
    I purchased a powermac pro and it came with logic Pro 9 (but with out the additional suite of programs that comes with). How can I reregister or reinstall Logic Pro 9 to get those features?

  • Hi, i have a MBP 13, late 2012. Its over an year old since purchase and now out of warranty. This morning the computer did not boot so i went down to apple store and they looked at it and said its a logic board failure requiring replacement worth£350

    Hi, i have a macbookpro 13, late 2012. I bought it last year october and its an year old and now out of warranty. This morning the computer did not boot, so i went down to apple store and they looked at it and said its a logic board failure and needs replacement worth £350. The tech at apple store gave no explanation, why suddenly, my computer decided not to start at all and said to me it was a logic board failure for no apparent reason and requires replacement. I have maintained the laptop in a pristine condition. Now I feel I have been cheated. This clearly means the product is substandard as a £1100 laptop is not expected to fail in just over a year. My last laptop PC which was worth £450 served me for 4 years before it crashed and lived for another 2 years until I decided to get a mac. This is ridiculous. I don't have apple care at the moment which translates as pay to get it fixed. Anybody in my situation ? I want to sue apple for selling me a substandard good . Any thoughts? Should I go for another pc for £500 because there is no guarantee even after the laptop were fixed by apple for £350 it would last for another year. I need a reliable machine.

    This morning my MBP just woke up from sleep and is working without any glitches. I don't know what to say about this.

  • Logic express is not reading tascam us144

    I've tried removing and reloading both programs and drivers, no joy. BUT garageband is reading it. Anyone able to help?

    Firstly, open up the 'Audio MIDI Setup' utility ( Applications > Utilities ) & make sure you can see your interface. From what you say, you should be able to, so this is just a quick double-check (since if you can't, we'll have to deal with that first).
    Each of your devices should appear in the Environment, since unless they do, you won't be able to assign tracks.
    Normally you would do this by running the Logic Setup Assistant, which runs automatically the first time you run Logic; but you can run it again if you need to:
    Logic > Preferences > Start Logic Setup Assistant…
    If you DO run it, then when you've finished you'll have to restart Logic.
    Once your interface is safely appearing in the Environment (you may not even need to check this yet; but do so if there's still a problem), You can create a track (e.g. by
    Track > Create )
    & then by clicking & holding on the icon in the track (in the Arrange Window), you will be able to select the instrument you want from an hierarchical menu.
    That should be enough to get you started, & hopefully you can see how to do the rest from there on. If you didn't get that far, just LMK where it went wrong! More details on request…

  • I was working on numerous songs in Logic Pro 9, and for some reason 2 of the songs would not bounce. I get an error message: Error in parameter list / Not an existing volume, and no default volume / Bad positioning information / Bad drive number

    I was doing some minor editing in Logic Pro 9.1.8, like adding some plug-ins to audio and midi tracks on numerous songs. Most of the songs I had no problem bouncing. For some reason 2 of the songs I tried to bounce kept showing me this error message:
    "Error in parameter list / Not an existing volume, and no default volume / Bad positioning information / Bad drive number" result code=-50.
    The songs open and play fine, but won't let me bounce. I've worked with Logic for a few years and this has never happened. Any suggestions?
    Thanks,
    Johnny

    Fixed! Ran disk utilities and repaired my external HD.

  • Hello i just bought the new 15'' retina macbook pro and i also own logic pro9. how do i transfer logic to my new macbook?

    hello i just bought the new 15'' retina macbook pro and i also own logic pro9. how do i transfer logic to my new macbook?
    do i have to some how ask apple to send me a download link? will apple try to get me to buy another copy?
    thanks for your reply.

    openlampost wrote:
    ...  im thinking that i need to download it from apple ...
    The only way to do that is to Purchase it from the Mac App Store.
    openlampost wrote:
    ... i bought the boxed set logic 9 as an upgrade from logic express9 ... i simply installed logic using dvd drive. ...
    In that case... Install it on your New Mac using the Disc(s) and have all your Serial Numbers handy in case you are asked for them during the Install.
    After the successful install... run Software Update to get any and all Updates... Then Restart your Mac and you should be good to go.
    PS:
    Make sure your MBPr is connected to the Mains for this Long process...

Maybe you are looking for

  • Mac mini with minidisplayport to vga adapter: display does not sleep

    I have a late 2009 mac mini. When using a mini displayport-vga adapter from Apple, whenever the mini puts the display to sleep the video goes black and my monitor goes into test mode (not sleeping). It's almost like the signal to tell the display to

  • After transfer of sc the message in PO results in error

    we transfer SC to our backend system and generate a PO, this PO triggers a message in the nast which results in a mail to be send to the vendor with a PDF attached with all the info of the PO. Now all of a sudden the attached pdf got corrupted, after

  • Annoying Launchd Items, How do I remove them?

    Software that I installed earlier but removed completely with FindAnyFile is still spamming my log. Little Snitch and Akamai for the free trial of Photoshop (which didn't even work) keep trying to launch. I've already looked in the LaunchAgents and L

  • Sender File adapter stops polling

    Hi All, We have a strange issue. A sender File (NFS) communication channel which was working fine, suddenly stops polling. The cache, is upto date. There are no errors in the channel monitoring. In fact the polling logs are being recorded in the RWB

  • How can i insert the variable value in MS ACCES Query

    i am creating one Query (query1) in MS ACCESS ( like we creaate Tables, Forms and Reports in MS ACCESS ) in this Query i have given 2 constent value in BETWEEN CLAUSE , after that i Created a CROSS QUERY which is based on the privious Query (query1).