Time Out error problem when i run the report for the whole plant

Dear all,
pls find the below coding, when i execute this report for the whole plant , it gives me time out error since it has to process huge database. pls suggest me in which part of my below coding i can improvise or any other better way to fetch the same result.
pls note that
i m using Views for querying.pls also note the comments given in Bold to understand the reason behind the coding.
Views used in are - ZVPOD and ZVPRDCONF.
START-OF-SELECTION.
  Data: zstat type jest-stat.
  data: stklocaf type mska-lgort.
  data: stklocas type mska-lgort.
<u><b>To collect the status of the production order by joining the ZVPOD and JEST table.</b></u>
  CLEAR it_ZVPRODDET.
  SELECT DISTINCT ZVPOD~bukrs ZVPOD~aufnr ZVPOD~objnr
  jest~stat ZVPOD~werks ZVPOD~arbpl ZVPOD~J_3AKORD2
  FROM  ZVPOD
  INNER JOIN jest ON ZVPOD~objnr = jest~objnr
  INTO CORRESPONDING FIELDS OF wa_ZVPRODDET where
  plnbez in FGM and arbpl in wc and werks in plant
  and SSAVD in eldate
  and J_3AKORD2 in cups and jest~inact ne 'X'.
    APPEND wa_ZVPRODDET TO it_ZVPRODDET.
  ENDSELECT.
  SORT it_ZVPRODDET BY aufnr stat.
<u><b>Loop thru Itab to check and delete the records from itab for the specified status.</b></u>
  LOOP AT it_ZVPRODDET INTO wa_ZVPRODDET.
    IF wa_ZVPRODDET-stat = 'I0045' .  " TECO - compl
      DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr.
    ELSEIF wa_ZVPRODDET-stat = 'I0009' .  " CNF - Confirmed
      DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr.
    ELSEIF wa_ZVPRODDET-stat = 'I0012' .  " DLV - Delivered
      DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr.
    ELSEIF wa_ZVPRODDET-stat = 'I0046' .  " CLSD - Closed
      DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr.
    ELSEIF wa_ZVPRODDET-stat = 'I0076' .  " DLFL - Del Flag
      DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr.
    ELSEIF wa_ZVPRODDET-stat = 'E0003' .  " SCLS - Short Close
      CLEAR tj30t.
      SELECT SINGLE txt04
      FROM tj30t INTO tj30t-txt04
      WHERE stsma = 'PRDHOLD' AND
            estat = 'E0003' AND
            txt04 = 'SCLS' AND
            spras = 'EN'.
      IF sy-subrc = 0.
        DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr.
      ENDIF.
    ENDIF.
*      Condition for Prod Order released - REL
    IF wa_ZVPRODDET-stat = 'I0002'.
      mreleased = 'Y'.
    else.
      mreleased = 'N'.
    endif.
    zstat = wa_ZVPRODDET-stat.
    IF mreleased = 'N'.
      DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr
      and stat = zstat.
    ENDIF.
  ENDLOOP.
<u><b>Loop thru the filtered ITAB to get all the production order details for the production order number specified in the where clause( zaufnr ) and populate another internal table.</b></u>
      LOOP AT it_ZVPRODDET INTO wa_ZVPRODDET.
        zaufnr = wa_zvproddet-aufnr.
        zarbid = wa_zvproddet-arbid.
        at new aufnr.
          SELECT DISTINCT * INTO CORRESPONDING FIELDS OF  walnpln
          FROM zvpod where plnbez in FGM and arbpl in wc and SSAVD in
         eldate and werks in plant and J_3AKORD2 in cups and aufnr = zaufnr.
            APPEND walnpln TO itablnpln.
          endselect.
        endat.
      endloop.
      clear walnpln.
<u><b>
Looping thru Internal table and performs all the following calculations and inner loop
and also relevant querying.</b></u>
<u><b>Assume that ITABLNPLN holds appox. 8000 records.</b></u>
LOOP AT itablnpln  INTO walnpln.
        contot = 0.
        SELECT distinct * INTO CORRESPONDING FIELDS OF TABLE itablnp
        FROM zvprdconf where aufnr = walnpln-aufnr and
        j_3asize = walnpln-j_3akordx and stzhl ne '2' and stokz ne 'X'.
        clear zvprdconf.
        SELECT single isdd
        FROM zvprdconf into  zvprdconf-isdd
        where aufnr = walnpln-aufnr and
        j_3asize = walnpln-j_3akordx and stzhl ne '2' and stokz ne 'X'.
        SELECT single isdz
        FROM zvprdconf into  zvprdconf-isdz
        where aufnr = walnpln-aufnr and
        j_3asize = walnpln-j_3akordx and stzhl ne '2' and stokz ne 'X'.
        IF sy-subrc EQ 0.
          <u><b>Assume that ITABLNP  holds appox. 30 records.</b></u>
          loop at itablnp into walnp.
            contot = contot + walnp-J_3ALMNGA.
            move walnp-J_3ASIZE to walnpln-J_3ASIZE.
            move zvprdconf-isdd to walnpln-zdate.
            move zvprdconf-isdz to walnpln-ztime.
          endloop.
          walnpln-output = contot.
        endif.
        walnpln-wip = walnpln-menge - contot.
        if walnpln-werks = '1000'.
          stklocaf = '1050'.
          stklocas = '1060'.
        elseif walnpln-werks = '2000'.
          stklocaf = '2150'.
          stklocas = '2160'.
        endif.
       select single kunnr into walnpln-ship from vbpa where
       vbeln = walnpln-KDAUF and PARVW = 'WE'.
        zship = walnpln-ship.
        move zship to walnpln-ship.
        select  single kalab into walnpln-zactqty from mska
        where matnr = walnpln-plnbez
        and j_3asize = walnpln-J_3AKORDX and LGORT = stklocaf.
        condense walnpln-kdauf.
        zsales = walnpln-kdauf.
        concatenate zsales 'S' into zso.
        select single kalab into walnpln-zsndqty from mska
        where matnr = walnpln-plnbez
        and j_3asize = walnpln-J_3AKORDX and LGORT = stklocas
        and J_4KSCAT = zso.
        zmatn = walnpln-plnbez.
        zsale = walnpln-KDAUF.
        walnpln-kdauf = zsale.
        walnpln-plnbez = zmatn.
        zcust = walnpln-kunnr.
        walnpln-kunnr = zcust.
        select single bezei into walnpln-season from TVV2T where
        kvgr2 = walnpln-kvgr2 and SPRAS = 'E'.
        select single bezei into walnpln-shipmode from T173T where
        vsart = walnpln-vsart and SPRAS = 'E'.
        STRL = strlen( walnpln-j_3akord2 ).
        if  strl = 4.
          move walnpln-j_3akord2 to walnpln-j_3akord3.
          clear walnpln-j_3akord2.
        endif.
        move zremk to walnpln-remk.
        MODIFY itablnpln FROM  walnpln.
        contot = 0.
        clear itablnp.
      ENDLOOP.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM display_alv_report.

Hi raja,
Plese go through the suggessitions.
1.avoide the select ...endselect. write the below select
CLEAR IT_ZVPRODDET.
SELECT DISTINCT
     ZVPOD~BUKRS
     ZVPOD~AUFNR
     ZVPOD~OBJNR
     JEST~STAT
     ZVPOD~WERKS
     ZVPOD~ARBPL
     ZVPOD~J_3AKORD2
  FROM ZVPOD
  INNER JOIN JEST ON ZVPOD~OBJNR = JEST~OBJNR
  INTO CORRESPONDING FIELDS TABLE  IT_ZVPRODDET
  WHERE PLNBEZ IN FGM AND
        ARBPL IN WC AND
        WERKS IN PLANT AND
        SSAVD IN ELDATE AND
        J_3AKORD2 IN CUPS AND
        JEST~INACT NE 'X'.
  IF SY-SUBRC = 0.
    SORT TABLE IT_ZVPRODDET.
  ENDIF.
2..first of all dont delete a record inside the loop. instead use the Field symobols.
have u obsereved you code in the loop!!!!. wht u r doing..
u r removing the same record which u in the loop..
If u wanto delete the entires with check to<b> stat</b>... <b>then.. why dont u put the STAT field in Wher e condition..?</b> by this you reduce the data base select time..
Now the select query is like the below....
CLEAR IT_ZVPRODDET.
SELECT DISTINCT
     ZVPOD~BUKRS
     ZVPOD~AUFNR
     ZVPOD~OBJNR
     JEST~STAT
     ZVPOD~WERKS
     ZVPOD~ARBPL
     ZVPOD~J_3AKORD2
  FROM ZVPOD
  INNER JOIN JEST ON ZVPOD~OBJNR = JEST~OBJNR
  INTO CORRESPONDING FIELDS TABLE  IT_ZVPRODDET
  WHERE PLNBEZ IN FGM AND
        ARBPL IN WC AND
        WERKS IN PLANT AND
        SSAVD IN ELDATE AND
        J_3AKORD2 IN CUPS AND
        JEST~INACT NE 'X' AND
        ( STAT <> 'I0045' AND
          STAT <> 'I0045' AND
          STAT <> 'I0009' AND
          STAT <> 'I0012' AND
          STAT <> 'I0046' AND
          STAT <> 'I0076' AND
          STAT <> 'E0003' ).
  IF SY-SUBRC = 0.
    SORT TABLE IT_ZVPRODDET.
  ENDIF.
<b>3.</b> WHT IS MEANING OF THE SELECT
<b>  CLEAR TJ30T.
  SELECT SINGLE TXT04
  FROM TJ30T INTO TJ30T-TXT04
  WHERE STSMA = 'PRDHOLD' AND
        ESTAT = 'E0003' AND
        TXT04 = 'SCLS' AND
        SPRAS = 'EN'.
  IF SY-SUBRC = 0.
    DELETE IT_ZVPRODDET WHERE AUFNR = WA_ZVPRODDET-AUFNR.
  ENDIF.</b>....... IN WHERE CONDION U R GIven all are constant values right?..
why u need select it inside the loop.. u can write before the SELECT from ZVPOD..
that why first checke this field then go for fur thure selects..
<b>now u r code looks like this....</b>
CLEAR TJ30T.
SELECT SINGLE TXT04
  FROM TJ30T INTO TJ30T-TXT04
WHERE STSMA = 'PRDHOLD' AND
      ESTAT = 'E0003' AND
      TXT04 = 'SCLS' AND
      SPRAS = 'EN'.
IF SY-SUBRC = 0.
  CLEAR IT_ZVPRODDET.
  SELECT DISTINCT
       ZVPOD~BUKRS
       ZVPOD~AUFNR
       ZVPOD~OBJNR
       JEST~STAT
       ZVPOD~WERKS
       ZVPOD~ARBPL
       ZVPOD~J_3AKORD2
    FROM ZVPOD
    INNER JOIN JEST ON ZVPOD~OBJNR = JEST~OBJNR
    INTO CORRESPONDING FIELDS TABLE  IT_ZVPRODDET
    WHERE PLNBEZ IN FGM AND
          ARBPL IN WC AND
          WERKS IN PLANT AND
          SSAVD IN ELDATE AND
          J_3AKORD2 IN CUPS AND
          JEST~INACT NE 'X' AND
          JEST~STAT <> 'I0045' AND
          JEST~STAT <> 'I0045' AND
          JEST~STAT <> 'I0009' AND
          JEST~STAT <> 'I0012' AND
          JEST~STAT <> 'I0046' AND
          JEST~STAT <> 'I0076' AND
          JEST~STAT <> 'E0003' ).
    IF SY-SUBRC = 0.
      SORT TABLE IT_ZVPRODDET.
    ENDIF.
  ENDIF.
there are so many select inside the loop...... please Delete all of them.... write them be for the loop.......using the FOR ALL ENTRIES.....
THEN LOOP THE TABLE USING THE WHERE CONDITIONS.
<b>Plese write u updated code here again</b>..

Similar Messages

  • Get these two error messages when I run the iTunes exe file:  Error 2 and Error 2 (Windows error 2).  Both say Apple Application Support is required.  Uninstalled and tried to install again several times.  Using Windows 7 64 bit on laptop.

    Trying to install iTunes on my Dell laptop with Windows 7 - 64 bit.  Get these two error messages when I run the iTunes exe file:  Error 2 and Error 2 (Windows error 2).  Both say Apple Application Support was not found.  Can anyone tell me why this is happening?

    See Troubleshooting issues with iTunes for Windows updates.
    tt2

  • I have a problem when I run the DTP

    hello
    the day before , I load  data in a PSA "MASTER DATA" mode full,
    then in the morning  I load data again this "MASTER DATA."
    I can see  that the same lines do not not present a problem but the lines were changed, i have a problem when I run the DTP?
    I get this messages errors:
    .« the time interval & (from/to) for the data
    ecords 1 & and 2 & overlaps in characteristic 0COSTCENTER &.u201D
    u201CMessages for data records saved; request is red acc. to configurationu201D
    best regard
    francoise dinatale

    As this is a master data load, the attribute change run is mandatory before performing the next load.
    The probable reason for this is in the master data table there is an entry for a characterisitic value and the load resulted in another value. The difference between these two records is the object version. Exisitng record will have A version and the changed record has M version.
    So when we active master data(attribute change run ) then M version overwrites A version and hence on a net we have only one record in master data table.
    Post the above task if we again load master data, as is in your case, then the record will find its place in M version.
    As the activation is not performed(probably), the system finds it difficult, with previously loaded M version and currently loaded M version and hence the reason for the message.
    Naveen.A

  • There is the error message when we run IR8A report

    Hi SAP expert,
    There is the error message when we run IR8A report via T-code PC00_M25_NCT8A, below is the error message
    "Assignment to valuation model is missing for calculation process 25 SGLS
    Message no. HRSEN00107
    Diagnosis
    There is no entry in the assignment table for valuation model and rounding rule (V_T525S) for the return value  for feature SENOR on the key date 07.12.2007 for the selected calculation process 25 SGLS (country grouping, calculation process, process step).
    At least one valuation model must be assigned to each calculation process in view V_T525S.
    Procedure
    Make an entry for this calculation process and return value for feature SENOR in view V_T525S (Assignment of Valuation Model and Rounding Rule).
    I would appreciate you very much if you could advise me how to solve this problem.

    Hi ,
    I am facing the same error like this,
    please let how did you solve this iisue ?
    thakn\s

  • Always pop-up  error mesage when i run the cd-rom program

    Always pop-up  error mesage when i run the cd-rom program - Macromedia Projector發生問題,必須關閉,謹此致歉

    You need to disable "Autoplay" for your CD drive. In the Control Panel under Hardware.

  • Time Machine error -6584 can't run the programme, using new time capsule. Help please!

    Bought a new time capsule and it appears to be OK, my Macbook has backed up nicely. Tried to get my imac 27" intel to do the same. Can seee the capsule and can save to the capsule but Time Machine won't run. I just get the error message -6584 .... any ideas anyone?

    The problem seems to be common. Time Machine won't start: i.e. "it"... or the "Stars Wars" thing...
    The following process eliminated the "error -6584"
    Brand new out of the box, 2TB Time Capsule 4th Gen, backed up my iMac 24/4GB/10.7.2 over ethernet with no problems or errors. Time Machine did several incementals over night while I slept. When I returned from work, ready to reimage the OS, I discovered TC hung on an hourly incremental. When I tried to re-establish connection, no dice (error -6584) .
    Several attempts to open the volume failed. I could manage all the preferences and configure the Time Capsule. I just couldn't open the back up or start Time Machine (app).
    I dropped the %HOSTNAME file from the archive folder in Finder into the Disk Utilities image window to verify and repair, but received "file in use".
    Restarting ("reset") the TC oddly resulted in renaming the volume label to "Unamed".  I open Airport Utilities and renamed the archive folder to "Data" as before...
    Now able to mount (login into) the volume... But it shows "--" in available volume space and no "Oldest" or "Latest" backups are displayed...  Not a good sign. Waiting for backup to start..... Looking for backup....
    Odd, instead of failing now, it started an incremental. Done!
    I am now able to open Time Machine (or that cool Star Wars thingy that takes you off somewhere) and review all the backups starting with the first one I created before I went to bed last night.
    The question seems to be what created the problem. I suspect my iMac went to sleep (shut down HDD) in the middle of an incremental. That may have set the "in use" flag on the archive and OS X didn't know how to handle that when I woke the machine up.
    I hope this helps, and corrects my problem permanently.

  • I get an error 10403 when I run the Count non ttl pulse vi.

    I put some probes on my error path and then I highlighted the execution of the vi, and the error occured when the AI Start vi executes.I h/l the execution of the AI Start vi and the error occured when the first trigger config executed.We are now down to a Library function, and I can't find the problem.

    Hello,
    Thank you for contacting National Instruments.
    This error usually occurs when you have your application configured to do something that your board physically does not support.
    If you can provide a little more information about the hardware you are using, I may be able to narrow down the problem further.
    Matthew C
    Applications Engineer
    National Instruments

  • I keep getting time out error messages when trying to install flash player

    I've put a new install of Win 7 64 bit pro onto a new hdd.  All other s/w has worked fine and not given me any issues except for adobe flash player.  If I just install FP 11 it installs ok.  Issue happens when I try to install the "other" version for Steam.  The install screen stops at 11%, shoots up to 47%, then I get a timeout error message.  If I uninstall and install the Steam version 1st it works then the regular version gets the same timeout error.  I have folllowed all advice from previous threads on this topic such as disabling firewall (I use Panda), a clean adobe install using the flash player uninstall program and removing reader as well then going through the registry and removing all mention of adobe, etc, etc.
    I found a partial way around this.  I installed the Steam version of flash player, then found a website that I could download flash player 10 executable from.  I was able to run that and get both versions of flash player going on my system.  Then the flash player went and found the update to version 11.  I've just tried to install that and I end up with the exact same error messages all over again.
    Is there website that I can download the executable file for flash player 11 from or a link to it on the adobe website?

    I am not sure what you mean by "Flash Player for steam"; the only Flash Player installers I know is the ActiveX (for Internet Explorer) and the plugin (for other browsers); you can find both at http://helpx.adobe.com/content/help/en/flash-player/kb/installation-problems-flash-player- windows.html#main-pars_header
    [topic moved to Flash Player forum]

  • Error message when I run the Web Dynpro Project

    Dear friend,
    I had deploy & run project, but it's got the error message under the line:
    I had install NWDS V. 2.0.11 on my PC, but the project which I deployed was the version that I created by NWDS V. 2.0.9, and I had install new OS as XP Home instead the old one (Windows2000), are these the cause of problem?
    Please advise how can I do.
    Best regards,
    SeMs
    Web Dynpro client:
    HTML Client
    Web Dynpro client capabilities:
    User agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Media Center PC 3.0; .NET CLR 1.0.3705), version: null, DOM version: null, client type: msie6, client type profile: ie6, ActiveX: enabled, Cookies: enabled, Frames: enabled, Java applets: enabled, JavaScript: enabled, Tables: enabled, VB Script: enabled
    Web Dynpro runtime:
    Vendor: SAP, Build ID: 6.4009.00.0000.20041104173322.0000 (release=630_REL, buildtime=2004-11-18:22:17:10[UTC], changelist=298578, host=PWDFM027)
    Web Dynpro code generators of DC local/ZWelCome:
    SapDictionaryGenerationCore: 6.4011.00.0000.20050127161623.0000 (release=630_VAL_REL, buildtime=2005-02-20:21:34:47[UTC], changelist=324383, host=PWDFM026.wdf.sap.corp)
    SapMetamodelWebDynpro: 6.4011.00.0000.20050121170001.0000 (release=630_VAL_REL, buildtime=2005-02-20:21:38:14[UTC], changelist=322883, host=PWDFM026.wdf.sap.corp)
    SapMetamodelCore: 6.4011.00.0000.20050121165648.0000 (release=630_VAL_REL, buildtime=2005-02-20:21:28:49[UTC], changelist=322878, host=PWDFM026.wdf.sap.corp)
    SapWebDynproGenerationTemplates: 6.4011.00.0000.20050217164947.0000 (release=630_VAL_REL, buildtime=2005-02-20:21:53:22[UTC], changelist=329752, host=PWDFM026)
    SapWebDynproGenerationCTemplates: 6.4011.00.0000.20050217164947.0000 (release=630_VAL_REL, buildtime=2005-02-20:21:53:22[UTC], changelist=329752, host=PWDFM026)
    SapGenerationFrameworkCore: 6.4011.00.0000.20041104141254.0000 (release=630_VAL_REL, buildtime=2005-02-20:21:28:00[UTC], changelist=298452, host=PWDFM026.wdf.sap.corp)
    SapIdeWebDynproCheckLayer: 6.4011.00.0000.20050215134310.0000 (release=630_VAL_REL, buildtime=2005-02-20:21:42:02[UTC], changelist=329103, host=PWDFM026.wdf.sap.corp)
    SapMetamodelDictionary: 6.4011.00.0000.20040609163924.0000 (release=630_VAL_REL, buildtime=2005-02-20:21:32:12[UTC], changelist=253570, host=PWDFM026.wdf.sap.corp)
    SapMetamodelCommon: 6.4011.00.0000.20050121165648.0000 (release=630_VAL_REL, buildtime=2005-02-20:21:28:59[UTC], changelist=322878, host=PWDFM026.wdf.sap.corp)
    SapWebDynproGenerationCore: 6.4011.00.0000.20050215134310.0000 (release=630_VAL_REL, buildtime=2005-02-20:21:42:32[UTC], changelist=329103, host=PWDFM026.wdf.sap.corp)
    SapDictionaryGenerationTemplates: (unknown)
    Web Dynpro code generators of DC sap.com/tcwddispwda:
    No information available
    Web Dynpro code generators of DC sap.com/tcwdcorecomp:
    No information available
    J2EE Engine:
    No information available
    Java VM:
    Java HotSpot(TM) Server VM, version: 1.4.2_08-b03, vendor: Sun Microsystems Inc.
    Operating system:
    Windows 2000, version: 5.0, architecture: x86
    Message was edited by: Sukasem S.wattanakoon
    Message was edited by: Sukasem S.wattanakoon

    Probably the usual problem of deploying an application built with a newer NWDS (SP11) on an older server (SP9).
    But without the stacktrace this is only a guess.
    Armin

  • BPC Optimization Server Time Out error message

    We’re using BPC 7.5 MS and on patch level 111.02
    There’s two front-end servers and one back-end.
    When completing a full optimization with compression on an application we immediately get the optimization popup screen with no processing information only a “Server Time Out” error message.
    Optimization was taking a long to time run and sometimes timed out.  To try and resolve this issue we have just updated indexes and statistics and during our test in production we now receive the “Server Time Out” error message immediately. However, the records from tbl.Factwb and tbl.Fac2 did move to the tbl.Fact.
    Our development environment test ran fine.
    Any suggestions?
    Thanks.

    Hi Michael,
    please look in the logs maybe you will found more informations regarding the timeout and eventually share it.
    There are several notes about a timeout in 10 version,
    1394533 - 'Server Time Out' error when performing Modify Application, Full Process of a dimension, or Full Optimize this is related with NLB
    but it could be also related with the web.config 1628908 - How to fix Optimize with compress time-out failure
    or if you reach the max number of connection
    1635749 - Error Message: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool
    Regards
         Roberto

  • Select count(*) cause time out error

    I invoke the following statement:
    select count(*) as total from table1
    where table1 is large(30000 rows), total size of the database is more than 20GB.
    The above statement will cause time out error. How to solve the problem?

    Hallo chcw,
    a timeout in a table with 30.000 records is very unusual (for a simple SELECT COUNT). From my point of view Dan is on the right way and you will have a typical blocking scenario.
    1. if you have LOBs they won't be part of a SELECT COUNT (either its a heap of a clustered index)
    2. Microosft SQL Server will ALWAYS use the smallest index for such a simple SELECT
    3. if it is a heap you will run into a blocking scenario if someone is updating records and transaction has not committed.
    4. Check the isolation level of the transactions - but I expect the standard which is "read committed".
    Just a demonstration of "SELECT COUNT" will work whether it is a clustered index or a heap. The next script will create a heap with a LOB and additional attributes:
    CREATE TABLE dbo.foo
    Id INT NOT NULL IDENTITY(1,1),
    n1 INT NOT NULL,
    n2 SMALLINT NULL,
    c1 CHAR(250) NOT NULL,
    c2 CHAR(250) NULL,
    c3 VARCHAR(MAX) NOT NULL DEFAULT (REPLICATE('A', 15000))
    GO
    Now we enter 30,000 records into the table
    SET NOCOUNT ON;
    DECLARE @i INT = 1;
    WHILE @i <= 30000
    BEGIN
    INSERT INTO dbo.foo (n1, c1) VALUES (@i, 'Just a filler');
    SET @i += 1;
    END
    GO
    Keep in mind that we have a HEAP and NO indexes! To check the IO i use the following command befor any of the following examples:
    SET STATISTICS IO ON;
    GO
    Let's start with a first try and you will check as a result the produced IO depending on the affected table partitions:
    -- USE SELECT in a HEAP
    SELECT COUNT(*) FROM dbo.foo;
    GO
    Output:
    Table 'foo'. Scan count 1, logical reads 2508, ..., lob logical reads 0,
    As you can see from the result the LOB-data won't be attached only the "in-row-data" are affected (which are stored in 2508 pages. The reason is a quite simple one: Microsoft SQL Server uses different allocation units for in-row-data and LOB
    SELECT p.object_id, p.index_id, p.rows, au.total_pages
    FROM sys.partitions AS P INNER JOIN sys.allocation_units AS AU
    ON(p.partition_id = au.container_id)
    WHERE object_id = OBJECT_ID('dbo.foo');
    Now I create a simple index on the column n1 which is an INT-datatype
    SELECT p.object_id, p.index_id, p.rows, au.total_pages
    FROM sys.partitions AS P INNER JOIN sys.allocation_units AS AU
    ON(p.partition_id = au.container_id)
    WHERE object_id = OBJECT_ID('dbo.foo');
    and run the SELECT COUNT again with the following IO-output:
    Table 'foo'. Scan count 1, logical reads 69, ...
    WOW - only 69 pages have to be read. The explanation is a quite simple one - now we have an index which is quite small. Microsoft SQL Server WILL use the smallest index of a table to scan the number of records. Let's try it again with n2 which is a smallint
    (2 bytes)
    CREATE NONCLUSTERED INDEX ix_foo_n2 ON dbo.foo (n2);
    GO
    The IO will be 62 (or less) because MORE index records a fitting to one data page!
    Conclusion is that either you have small record size or long record size - The query optimizer will always use the smallest index for the execution (that's maybe why Visahk has asked for the execution plan).
    I don't believe it is because of the "huge amount of data" but - as Dan has pointed out - it HAS TO BE a blocking scenario which can have multiple reasons. For demonstration of a blocking scenario open SSMS and start in the query windows with the following
    command(s):
    BEGIN TRANSACTION
    UPDATE dbo.foo
    SET c1 = 'This is my name'
    WHERE Id = 10000;
    -- What locks do we have now in the database
    SELECT resource_description,
    resource_associated_entity_id,
    request_mode,
    request_type
    FROM sys.dm_tran_locks AS DTL
    WHERE resource_database_id = DB_ID() AND
    resource_type != 'DATABASE';
    Your result should look like that (with differences in the entity_id and resource descriptions :)
    The above pic demonstrates the "locking chain". As you can see the slot 7 on PAGE 82400 has an exclusive lock. This means that NO OTHER request can currently obtain another lock to it!
    Now open a second query window and run a SELECT COUNT... - it will not finish!
    The reason is that the second requests has to wait for the release of the locked resources by the first transaction! Leave the statement and change back to the first transaction and finish the transaction by cancellation of the query. In the moment the locks
    have been released the second query will finish immediate.
    So - from my point of view - Dan has given the correct answer. Against wide spreaded statements a heap won't block the whole table exclusivly but - as in a cluster, too - only the row itself (see the 7 which is the slot where the record exists).
    MCM - SQL Server 2008
    MCSE - SQL Server 2012
    db Berater GmbH
    SQL Server Blog (german only)

  • MODBUS - 6101 Time Out Error

    Hi,
    I have a Honeywell UDA2182 controller and am trying to read 3 data channels from it using Labview 2010 SP1 (running on XP with the VISA and MODBUS libraries installed). The PC is connected to the controller via a RS485 - USB converter.
    I keep getting Error 6101 - time out error and can't resolve the problem.
    The channels are from registers lines 0-3 for inputs 1 and 2 and 37-38 for input 3. If I read only inputs 1 and 2 then I don't get this error. If I read all 3 (involving reading registers 0-38) then the error occurs. It seems like it can't deal with so much data. Is there a way of reading 0-4 followed by 37-38 or only registers 0-4 and 37-38? I tried to do this using a flat sequence structure but it dosen't work, the software runs really slowly and does not sample at the correct frequency.
    This reading the channels extra channels that i'm currently reading might not solve my problem and hence I'd obviously be open to suggestions on how to remove this error. I have had a read up on this error but haven't managed to solve it.
    I have attached the sequenced and origional .vi's i have made.
    Attachments:
    Hydro Stacked.vi ‏104 KB
    HydroORIG.vi ‏100 KB

    Carlr,
    Your modified code doesn't work because you've opened to references to the same VISA resource.  See the attached snippet for an example of reading two different things from the same instrument.
    Attachments:
    MODBUS Read.png ‏53 KB

  • Yokogawa WT 200 time out error

    I am using yokogawa WT 200 for reading khw of my oven.I am attaching the vi which I wrote for that also required library.I using GPIB to communicate which is connected to USB at the computer end.
    I am getting this 1073807339 Timeout expired before operation completed.
    I tried by changing delay by using wait until next .
    If there is any other way to change visa time out values plz let me knw....
    Attachments:
    kwh measure.vi ‏35 KB
    Yokogawa WT200 Series.zip ‏677 KB

    Changing the timeout value is not going to eliminate the error. With GPIB, the timeout error almost always occurs because the instrument has no data to send. Increasing the timeout inly increase the amount of time it takes to report the error. Why the instrument does not have any data, I do not know. It could be a failure in the setup. Have you run either of the examples that are in the driver? Do you get the same error when you do? After the read times out or before, have you run the error query to see if the instrument is in some sort of error mode?

  • HT1338 Why do I get so many "time out" connection problems?

    I keep getting "time out" connection problems when I am on computer.  I am also experiencing a lot of "spinning wheeling" issues.  Are they related?

    Hi Garima,
    These are the three I use and I get 1 or 2 updates a day on most days....why?
    Best regards,
    Haye Kesteloo
    ServiceSpider, LLC
    100 Mill Plain Road
    Danbury, CT 06811
    Cell: +1 203 522 6727
    www.servicespider.com

  • Getting time out error when running the assigned verification in DRM 9.3.2.

    Hi,
    I have installed DRM 9.3.2.0.0 in my system (windows 7), when i am trying to run assigned verifications i am getting the time out error within a minute.
    As suggested by oracle,I have added DWORD with value 480000 under Master Data Management in Registry editor. But still getting the error.
    Please suggest a solution for this issue.
    regards,
    sathiya

    Please suggest me the solution.
    regards,
    sathiya

Maybe you are looking for

  • Itunes 10.5.3 crashes on startup in Lion 10.7.3

    Hey so my itunes library is on a external harddrive. When I launch itunes it starts normaly but crashes within second of being open. I'm pasting the crash log below.  I think it may be a issue with the library file. Any insite would be greatly apprec

  • How to resolve the issue of route while creating a sales order using IDOC

    Hi, When I am creating a sales order mannualy the the route is correct and matching  also but while using IDOC try to create a sales order then the route is showing wrong. I tried to debug the program SAPMV45A but I am not getting anything. Could any

  • Mail app won't switch to landscape mode?

    Hi all, As of this morning my Mail app seems to be stuck in portrait mode. Any clues on how I can resolve this problem? Thanks in advance, Tom.

  • Truncated data value displayed in Answer

    Hi All , When i make a query using a column in BI Answer, i am getting the truncated data. It does not display complete text data. I am using a XLS as data source. Size of this text data is 500 -600 char. By default it's data type is Varchar and size

  • How to block an email sender?

    I want to block emails from /pinterest/ they do'n have unsubscribe in mails.