How to reduce logical count and scan count for a select query

hi,
I have two tables one is master and other is history. i need to combine this two tables into one temporary table.
I am using the below query to create temp table.
Select * into temporders
from
(select * from orders
union
select * from ordershistory) b
where updateon= (select max(updateon)from (select updateon,name,units,subunits from orders
union
select updateon,name,units,subunits from ordershistory) a
where updateon <='11/08/2008 11:18 AM' and a.name=b.name and a.units=b.units and a.subunits=b.subunits group by name,units,subunits)
order by report,subunitsorder
the statistics for this query:
SQL Server parse and compile time:
CPU time = 47 ms, elapsed time = 62 ms.
Table 'Worktable'. Scan count 556, logical reads 1569, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'ORDERSHISTORY'. Scan count 116, logical reads 339, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'ORDERS'. Scan count 116, logical reads 285, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
SQL Server Execution Times:
CPU time = 32 ms, elapsed time = 63 ms.
(115 row(s) affected)
you see logical reads and scan count for worktable(temporary) is quite high.
So anyone can give a solution for reduce the scan count and logical reads.
NOTE: name,units, subunits,updateon columns have primarykey

SQL ServerAm i reading it properly? :(
This is Oracle Forum And not the SQL Server.
Regards.
Satyaki De.

Similar Messages

  • How can pkg-get resolve and install dependancies for a selected package?

    Hi all,
    i am using pkg-get for installing phpmyadmin an a solaris 10 os.
    when i do "pkg-get -i phpmyadmin", hi try to install apache2 but he cannot because he don't want to install the dependancies for his package
    -bash-3.00# pkg-get -i phpmyadmin
    WARNING: gpg not found
    No existing install of CSWphpmyadmin found. Installing...
    Pre-existing local file phpmyadmin-3.1.2,REV=2009.02.27-SunOS5.8-all-CSW.pkg.gz matches checksum
    Keeping existing file
    Analysing special files...
    Trying to install dependancy apache2
    No existing install of CSWapache2 found. Installing...
    Pre-existing local file apache2-2.2.11,REV=2009.03.29-SunOS5.8-all-CSW.pkg.gz matches checksum
    Keeping existing file
    Analysing special files...
    Trying to install dependancy apache2c
    Error: dependancies for apache2c not up to date.
    You may call pkg-get again with '-v -u apache2c' to see which ones
    Or, call pkg-get with 'upgrade all' to bring all installed pkgs up to date
    ERROR: install of CSWapache2c failed
    ERROR: could not install required dependancies for CSWapache2
    Once dependancies are up to date, call
            /opt/csw/bin/pkg-get -i apache2
    to (re)install
    ERROR: install of CSWapache2 failed
    ERROR: could not install required dependancies for CSWphpmyadmin
    Once dependancies are up to date, call
            /opt/csw/bin/pkg-get -i phpmyadmin
    to (re)installif i want to install apache2c, he don't want, because he don't have the dependancies, etc....it's infernal, i try "pkg-get -u" for upgrade all package, but it's don't resolve any thing.....
    have we a way for configuring pkg-get for installing the dependancies by himself? (like apt-get)
    another pb : when i try to install one of the dependancies, i have the messsage "Les conventions d'administration syst&#65533;me n'autorisent la cr&#65533;ation que
    d'une seule copie du module <CSWggettextrt>. Or, le nombre maximal de
    copies de module admis en m&#65533;me temps et sur le m&#65533;me syst&#65533;me est d&#65533;j
    atteint.
    "sorry it's in french but it said that he don't want to install the package because "the system administrattion convention allow only one copy of the package", it is because it's already installed?
    thank for your help....

    Hi
    For the last problem, what does
    pkginfo | grep gettext
    show?
    Paul

  • How to find MATCH count for #  in a String

    Hi all,
    How to find MATCH count for #  in a String.
    Ex:  6170#0400-0002-00#API3PT#AL#AUST#DEVE#KG#100.00#100.00#100.00#0.00##10.20
    Regards,
    Balavardhan.K

    >
    balavardhan k wrote:
    > I have used below syntax to find count but it is not returning the value and SY-SUBRC  = 4.
    >
    >
    > Data : l_text type string.
    >
    > l_text = '6170#0400-0002-00#API3PT#AL#AUST#DEVE#KG#100.00#100.00#100.00#0.00##10.20'.
    >
    >
    > FIND ALL OCCURRENCES OF '#' IN L_TEXT MATCH COUNT mcnt .
    Then it's not a # but possible a horizontal tab-sign.
    Do a find on cl_abap_char_utilities=>horizontal_tab instead.
    Edited by: Maen Anachronos on Nov 23, 2010 2:48 PM

  • VMM 2012: How to Configure Automatic Start and Stop Actions for a Virtual Machine?

    Does somebody know how to confgure Automatic Start and Stop Actions for a Virtual Machine in VMM 2012?
    I miss that option.

    Automatic Start or Automatic Restart actions are available for virtual machines running on a Hyper-V cluster from within Virtual Machine Manager.
    From within Virtual Machine Manager, bring up the Virtual Machine's properties:
    Click "Hardware Configuration"
    Click "Availability"
    Click "High", "Medium", or "Low" to enable automatic start/restart or
    Click "Do not restart automatically" to disable automatic start/restart
    Screenshot from VMM 2012 for a VM running in a Server 2012 R2 Hyper-V cluster:
    VMs running on a cluster have to be marked "Highly Available" and logically, Microsoft assumes that you'll want these VMs to be running all the time when this setting is selected.  If the cluster fails or needs to be restarted, you can set the priority
    by which a VM restarts, or you can set the VM to not restart at all when cluster services are restored by using the settings above.

  • How to reduce the size of the paper for form in sapscripts?

    Hi All,
    How to reduce the size of the paper for form in sapscripts?
    Thank you.
    Regards,
    Alice

    Goto SE71, enter your form name and press F6.
    Now goto Basic Settings (Button Top right in the Dynpro, not in the button bar tho).
    Now change page format and orientation to desired one.

  • How to know Sales Organization and distribution channel for a material

    How to know Sales Organization and distribution channel for a created material

    Hi,
    For a single material means u can go mm03 7 select the material number 7 select the sales views then press f4 the details u can see.
    For any number of materials u can go to se11 & give table name MVKE then select the required parameters & execute.
    pandari

  • Can anybody tell me how to extract sales value and cost value for an materi

    dear all,
    Can anybody tell me how to extract sales value and cost value for an material sold .
    All the values of cost value and sale values are getting  stored in bseg-wrbtr field .
    How to identify them uniquely.
    Or there is another way to find the sale and cost values.
    Regards
    Mave

    Hi Mave!
    Normally there is no condition change, when something is sold.
    But sales price depends on sales conditions (not only price, but also surcharges, discounts, taxes - if customized).
    Nevertheless, after selling you have a invoice document, where correct values <i>should</i> be stored (see VBRP fields mentioned above). If here is a problem, then customizing of price determination is in question, not a programming of user-exits with MARD selection for costs (or some other tries to get a price).
    When you specify your requirements more in detail, you might get better answers - but currently only general hints are possible ('see in invioce / G/L accounts').
    Regards,
    Christian

  • How To Create A Technical And Business Systems For Web AS ABAP ???

    Hi Experts,
    How To Create A Technical And Business Systems For Web AS ABAP ???
    Please Let me Know All the Step-By-Step Process to Create ????
    Points Will be Given
    Regards
    Khanna

    Hi Sumit,
    When U Told the thing that first time to execute the RZ70 and All i Did this in XI System
    So I got An Entry for the Technical System for XI System.
    Now i Deleted that and Executed RZ70 in R/3.
    When I Executed RZ70, I got this Error.
    <b> "RFC Call failed: Error Opening an RFC Connection "</b>.
    Now I am Unable to see Any Technical System  Under Web As ABAP. It's Showing Empty Now.
    Please Let me know
    Regards
    Khanna

  • Define Logical Systems and Template Names for BW Reports

    Hi experts
    I would like to know if someone used the mentioned functionality 'Define Logical Systems and Template Names for BW Reports, I would like to know too IF I create a Z REPORT for example in webdynpro and insert it in this configuration it will work and where it will appear in sourcing cockpit?
    sds.
    Javier

    Hello Muthu,
    BW reports will be shown in SRM Box if the corresponding BW roles for SRM are integrated with SRM roles.
    You might to activate the corresponding datasource of this in SRM.
    And since you have to connect the source system to BW, I think you have to define SRM system as logical system in BW.
    Regards,
    Pavan

  • HT201320 how do you set up and exchange account for google mail

    how do you set up and exchange account for google mail

    If it's a free gmail account, you don't. Google no longer permits free accounts to be set up using Exchange Active Sync. Only paid google apps accounts can be set up as Exchange accounts.

  • I am looking to upgrade my macbook pro 13". I have a new logic board and have searched for the spec on this i.e. hdd size and ram. will my 2009 screen work with a updated graphics card ??

    I am looking to upgrade my macbook pro 13". I have a new logic board and have searched for the spec on this i.e. hdd size and ram. will my 2009 screen work with an updated graphics card ??

    Sounds just like what was happening with my Alum MB. I took it in and they replaced my battery. It seems to be ok now. I don't know what it is, but my battery was fine before 10.5.6 and the same timeframe of the firmware updates when they came out.
    My battery health was jumping around but was fine before all of this happened. Unfortunately at 381 cycles I don't think you have much chance of getting the battery for free. Perhaps you can complain about the battery saying it was fine until 10.5.6 or whatever. Not sure when your computer was made, but perhaps you are eligible for this program: http://www.apple.com/support/macbook_macbookpro/batteryupdate/

  • How to avoid the Amount and Date values for VOID Cheques

    Hi All,
    I had created a two window i.e For Amount and Date. If I process the cheque the Amount value and Date should not trigger for VOID CHEQUES.
    Can any one tel me how to avoid the Amount and Date values for VOID Cheques
    Your help will be greatly appreciated.
    Regards
    Yathish

    Hi,
    I dont know which tablel you are referring to, is it PAYR table and the field VOIDR?
    If a cheque is voided, it would have a reason and it is stored in VOIDR field of this PAYR table.
    Check if the field VOIDR is filled, if it is filled, do not print the amount and date.
    Regards
    Subramanian

  • How to have more months and years appear for selection in the archives for blog posts?

    Hello,
    How to have more months and years appear for selection in the archives for blog posts?  It just shows past 3 months in the year 2014, but we have many blog posts in years 2013, 2012 and 2011 and further back.  I am using the OOB SharePoint blog
    feature.
    Paul

    Hi,
    Thanks for the reply; it doesn't add anything as RSA6 was one of the options I listed and this was my fall back option if there was no other special treatment for the COPA datasources.
    I have found out why this, and other fields, are not available in KEB0.  The program uses a Function called KERA_COPA_METADATA_INTERFACE within which there is a section that selects the COPA fields:
    ***** 1. RULES (choice/class)
    * set rules for fixed fields
      PERFORM COPA_SET_RULES_FIXED_FIELDS USING I_ACCTCOST
                                          CHANGING E_T_RULES[].
    When you look at this code section there is a hard coded list of fields to exclude:
      MRULE 'MANDT     ' NEVER FORGET_IT NEVER FORGET_IT.
      MRULE 'PAOBJNR   ' NEVER FORGET_IT NEVER FORGET_IT.
      MRULE 'PASUBNR   ' NEVER FORGET_IT NEVER FORGET_IT.
      MRULE 'PAPAOBJNR ' NEVER FORGET_IT NEVER FORGET_IT.
      MRULE 'PAPASUBNR ' NEVER FORGET_IT NEVER FORGET_IT.
      MRULE 'HRKFT     ' NEVER FORGET_IT NEVER FORGET_IT.
      MRULE 'HZDAT     ' NEVER FORGET_IT NEVER FORGET_IT.
      MRULE 'USNAM     ' NEVER FORGET_IT NEVER FORGET_IT.
      MRULE 'RKESTATU  ' NEVER FORGET_IT NEVER FORGET_IT.
      MRULE 'TIMESTMP  ' NEVER FORGET_IT NEVER FORGET_IT.
      MRULE 'PERDE     ' NEVER FORGET_IT NEVER FORGET_IT.
      MRULE 'PERIO     ' OBLIGATORY CHAR_CE3 OBLIGATORY CHAR_CE3.
      MRULE 'COPA_AWTYP' NEVER FORGET_IT NEVER FORGET_IT.
      MRULE 'COPA_AWORG' NEVER FORGET_IT NEVER FORGET_IT.
    As this is a standard delivered SAP function I do not recommend that you change this code as you will invalid your SAP support and upgrade paths.
    Thanks
    Neil

  • How do you setup audible and visual notification for 2 hours elapsing?...

    How do you setup audible and visual notification for 2 hours elapsing?... on the iMac desktop Apple computer OS X 10.6.8 Snow Leopard.

    You can set the calendar to notify you of an event and then have subsequent alerts at 2 hour intervals.  A bit clumsy but would work.

  • HT5622 how do I go back and set up for emails to come to my ipod

    How do I go back and set up for emails to come to my ipod?

    Hello, if I'm understanding you, tap on the mail icon, enter the account address and password. Good luck, Cheers.

Maybe you are looking for

  • Acrobat: summarize highlighted text only in a new document?

    Hi everyone, I have marked some passages with the "highlight text"-tool in a big pdf file and want to extract only the marked text in a new file. Is this possible? So far I could only print a new file with information ABOUT the highlighted text, but

  • Jdom problem

    Hi all, I am trying to parse a xml file using a jdom java code.This code works fine if I remove xmlns attribute in the root element.Please tell me how to fix this issue. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Xml <process name="CreateKBEn

  • Master with many details form best layout

    Hi, I have one master table, and 5 detail tables. I need to build a form (or more) to maintain these tables . What is the best layout for this form ? should I use tab pages (generally not friendly) ? should I use separate forms ? Any best practices?

  • Duplicate notifications for encrypted messages

    Hi all, We're using our C150 to quarantine emails that arrive with some form of encryption (e.g. a password-protected .zip).  When a matching email first arrives, it's correctly quarantined and sends an "Encrypted message detected" notification to th

  • Table and views which are afftected during the SAP license post processing

    Hi, can anyone tell me those table and views which are afftected during the SAP license post processing process in SAP 4.7 installation on oracle. Regards, Abhishek