Write a SELECT statement in different ways is not the same thing!!!

Let's take a look
use AdventureWorks2012
go
dbcc freeproccache
go
and now select something
select * from [HumanResources].[vEmployeeDepartmentHistory]
go
so, analyzing 'Compiled Plan'
SELECT usecounts, cacheobjtype, objtype, text
FROM Sys.dm_exec_cached_plans
CROSS APPLY sys.dm_exec_sql_text(plan_handle)
where cacheobjtype = 'Compiled Plan'
ORDER BY usecounts DESC;
GO
and now let's write some SELECT in "fuzzy case"
dbcc freeproccache
go
select * from [HUMANResources].[vEmployeeDepartmentHistory]
go
select * from [HumanRESOURCES].[vEmployeeDepartmentHistory]
go
select * from [HumanResources].[VEmployeeDepartmentHistory]
go
select * from [HumanResources].[vEmployeeDEPARTMENTHistory]
go
select * from [HumanResources].[vEmployeeDepartmentHISTORY]
go
SELECT * from [HumanResources].[vEmployeeDepartmentHistory]
go
select * FROM [HumanResources].[vEmployeeDepartmentHistory]
go
and now let's see compiled plans again
SELECT usecounts, cacheobjtype, objtype, text
FROM Sys.dm_exec_cached_plans
CROSS APPLY sys.dm_exec_sql_text(plan_handle)
where cacheobjtype = 'Compiled Plan'
ORDER BY usecounts DESC;
GO
So, write a SELECT statement in different ways is not the same thing!!!
Hope it'll be useful
P.Ceglie

Yes.  There is little or no query normalization that happens in front of the query plan cache.  It would be a performance tradeoff to parse and normalize the query before matching it to the cached plans.  The benefit of reducing the number
of plans in the cache probably wouldn't be worth it. 
David
David http://blogs.msdn.com/b/dbrowne/

Similar Messages

  • I updated my Iphone4S this week to the newest IOS 7.1 and now everyone who calls me says the calls are not clear, muffled.  Is there something I can do to clear this?  4 people in 4 different states that called me all said the same thing.

    I updated my Iphone4S this week to the newest IOS 7.1 and now everyone who calls me says the calls are not clear, muffled.  Is there something I can do to clear this?  4 people in 4 different states that called me all said the same thing.

    Settings > General > Reset > Reset Network Settings
    Contact the carrier to troubleshoot.

  • Output count of SELECT statement is diff from count(*) of the same query

    Has this ever happened to you?
    I was wondering why some of the items were not appearing in my output. I have this select query:
        SELECT
            bukrs
            gjahr
            hkont
            belnr
            wrbtr
            dmbtr
            matnr
            bschl
            kunnr
            vbeln
            shkzg
        FROM bseg
        INTO CORRESPONDING FIELDS OF TABLE i_output
        FOR ALL ENTRIES IN i_bkpf
        WHERE
            bukrs EQ i_bkpf-bukrs
            AND belnr EQ i_bkpf-belnr
            AND gjahr EQ i_bkpf-gjahr
            AND hkont IN hkont
            AND hkont IN
                ('0004000000',
                '0004000010',
                '0004000020',
                '0004000030',
                '0004000040')
    When I tried to put sample filters (bukrs: 1000; belnr 1800000016; gjahr: 2005; hkont: 4000000), I am getting 3 entries from bseg. But when I tried using SE16 or SE16N, I am getting 6 (which is the expected output). When I modify the same SELECT query to return just the output count, I AM getting 6.
        SELECT count(*)
        FROM bseg
        INTO count
        FOR ALL ENTRIES IN i_bkpf
        WHERE
            bukrs EQ i_bkpf-bukrs
            AND belnr EQ i_bkpf-belnr
            AND gjahr EQ i_bkpf-gjahr
            AND hkont IN hkont
            AND hkont IN
                ('0004000000',
                '0004000010',
                '0004000020',
                '0004000030',
                '0004000040')
    Do you have any idea why this happens? My internal table is a standard table with no header line and no OCCURS statement.
    Kyle

    Hello Kyle,
    Thats because when using FOR ALL ENTRIES, it will delete the duplicates if the records selected dont have all the primary keys specified in the select query. In your first select query, the field BUZEI is missing which makes the records unique. Change your first select query as this and try
    SELECT
            bukrs
            gjahr
            hkont
            belnr
            buzei   -------> Add this and check
            wrbtr
            dmbtr
            matnr
            bschl
            kunnr
            vbeln
            shkzg
        FROM bseg
        INTO CORRESPONDING FIELDS OF TABLE i_output
        FOR ALL ENTRIES IN i_bkpf
        WHERE
            bukrs EQ i_bkpf-bukrs
            AND belnr EQ i_bkpf-belnr
            AND gjahr EQ i_bkpf-gjahr
            AND hkont IN hkont
            AND hkont IN
                ('0004000000',
                '0004000010',
                '0004000020',
                '0004000030',
                '0004000040')
    Vikranth

  • In Logic 9, is there any way of editing the take folders of, say, 7 different drum tracks at the same time, so that each track has the same changes applied to its takes?

    In Logic 9, is there any way of editing the take folders of, say, 7 different drum tracks at the same time, so that each track has the same changes applied to its takes?

    scottiewade wrote:
    Thanks. I know how to select multiple tracks in the mixer, did that and put on group clutch,
    Hi
    Wrong..
    To assign tracks to a group, click in the dark gray box just above the automation (Read/Write/Off etc) on a channel strip, and select the group number you wish to use. The first tim eyou assign a group, the Group Setting swindow will appear automatically, thereafter you need to click on the group area and choose 'Open Group Settings'.
    Make sure that you have turned off Group Clutch (this disables all Groups)
    Maybe this will help
    http://support.apple.com/kb/VI248
    CCT

  • [svn:osmf:] 10124: Add a few variations of HelloWorld, showing the different ways of adding the DisplayObject to the Sprite.

    Revision: 10124
    Author:   [email protected]
    Date:     2009-09-10 10:40:10 -0700 (Thu, 10 Sep 2009)
    Log Message:
    Add a few variations of HelloWorld, showing the different ways of adding the DisplayObject to the Sprite.
    Modified Paths:
        osmf/trunk/apps/samples/framework/HelloWorld/.actionScriptProperties
    Added Paths:
        osmf/trunk/apps/samples/framework/HelloWorld/HelloWorld4.as
        osmf/trunk/apps/samples/framework/HelloWorld/HelloWorld5.as
        osmf/trunk/apps/samples/framework/HelloWorld/HelloWorld6.as

    The connections which you have done are right, Here are some settings which you can set on your computer and check if this solves your problem or not.
    Win XP: Click on the Start button >>> go to RUN>> type in "ncpa.cpl"- hit OK >>Here(Network Connections) right click on the ""Local Area Connection"" icon and select properties-Here click on the "Configure"   jaspal button- Click on the "Advanced" tab- In the "Property" box highlight Link speed and duplex/Connection type/Network or Media type- And in the "Value" box select 10 Mbps half duplex/ 10 base T/10 base half mode and click on OK.
    If still you face the same problem, then i feel it might be the problem with the Switch itself. 

  • Best way to perform the same task wih arrays of different Objects

    Hello all.
    This isn't an XPath question, it's a much lower-level Java Object question, but it involves XPath. I hope that doesn't distract from the question, or confuse anything.
    I have 4-5 different types of Objects (call them A, B, C, etc.) that each contain an array of other Objects (call them a[], b[], c[], etc.)
    a, b, c, etc., each have an Xpath object and and XPathExpression. When I create each XPath object I assign it a NamespaceContext object which contains the namespaces needed for that XPath.
    When I create, for example, an A object, I pass is constructor an array of a and an array of Namespaces. With each a object I need to:
    1. create a NamespaceContext object
    2. go through all the Namespace objects and if its route matches,
    (if Namespace.route == a.getRoute() )
    3. add that Namespace to the NamespaceContext Object,
    4. assign the NamespaceContext to the XPath object, and finally
    5. create the a object, passing it the XPath object
    My problem / question is: I also have to do the same thing with B and b[], C and c[], etc. It's not that long of a process, not that much code, but all the same, I was wondering what the best way to write this code once would be, and have it work for all the different types of Objects.
    In other words, I'd like to write a mehod, call it assignNamespaces(), that accepts an array of Objects(a[], b[], c[], etc.) and an array of Namespaces, creates the XPath Object for each a, b, c, etc., and that creates and returns an array of a[],b[],c[], etc., sending the XPath Object as a parameter.
    That way when I create for example an A Object, I call:
    class A
    ObjectsWithXpath[] objectsWithXPath;
    this..objectsWithXPath = assignNamespaces(objectsWithXPath,namespaces);
    Should the assgnNamespaces() method simply use Class.forName() to see what type of Object it is and do a cast accordingly, or is there some other, more elegant way of doing this?
    I hope I've explained myself, and haven't bored you ...
    Thanks in advance,
    Bob

    Thanks for your reply!
    I poked around a bit looking into Factory classes. I've used them a million times but never actually made one. At any rate, they seem like a good idea when you have a bunch of different classes that are similar but not equal.
    In my case my classes ONLY have the XPathExpression in common. Which means that I'd have to make a base abstract class with a bunch of methods of which only a percentage are defined by any class that extends it. In other words, if I had 3 classes -- a, b and c -- that extend the base abstract class, and each had 5 getters and setters, the base abstract class would have 15 methods, 5 only used by a, 5 only used by b and 5 only used by c.
    It seemed a bit ugly to me. Besides, I only have 3 classes. I decided to factor out the inner loop, which is about 70% of the code, stick it in a utility class, and call it from there. I am repeating some code still, but it isn't that bad, and it saves me having to define an interface, an abstract class, a Factory class, etc.
    It ain't perfect, but then nothing ever is.
    Thanks for all the help! Viva the Java community!
    Bob

  • Select statement from a join file deletes the primary records with MS Expl.

    Hello,
    is reality,
    Select statement from a join file deletes the primary records with MS Explorer 6, Firefox not, this with a normal data provider or with a normal "select..." statement.
    This is very strange, I should have a.a.s.p. a solution or workaround
    Thanks, Franco.
    Message was edited by:
    fbiaggi

    Please see the following excerpt from the online documentation.
    http://docs.oracle.com/cd/E11882_01/server.112/e22490/ldr_modes.htm#SUTIL1332
    Enabled Constraints
    During a direct path load, the constraints that remain enabled are as follows:
    NOT NULL
    UNIQUE
    PRIMARY KEY (unique-constraints on not-null columns)
    NOT NULL constraints are checked at column array build time. Any row that violates the NOT NULL constraint is rejected.
    Even though UNIQUE constraints remain enabled during direct path loads, any rows that violate those constraints are loaded anyway (this is different than in conventional path in which such rows would be rejected). When indexes are rebuilt at the end of the direct path load, UNIQUE constraints are verified and if a violation is detected, then the index will be left in an Index Unusable state. See "Indexes Left in an Unusable State".

  • Challenge: Different ways to crash the JVM.

    This is a challenge to find different ways to crash the JVM with code written in Java.
    For starters: Mis-use of the Unsafe class.
    Field field = Unsafe.class.getDeclaredField("theUnsafe");
    field.setAccessible(true);
    Unsafe unsafe = (Unsafe) field.get(null);
    unsafe.getObject(null, 0L); // or many variations on methods in this class.

    Although I presume you mean the latest JVM (6u11), I can reproduce a crash with 1.5.0_05 fairly frequently using the SQL tool "squirrel" ( [http://squirrel-sql.sourceforge.net/]) during startup (while the splash screen is visible):
    # An unexpected error has been detected by HotSpot Virtual Machine:
    #  SIGSEGV (0xb) at pc=0xb7a02c41, pid=9019, tid=2651868080
    # Java VM: Java HotSpot(TM) Server VM (1.5.0_05-b05 mixed mode)
    # Problematic frame:
    # V  [libjvm.so+0x39ec41]The crash is not reproducible on 6u10 (haven't tried it with 6u11), so I don't know how relevant this tidbit actually is but would be glad to check into it with a few other JVMs. For what it's worth, the above happens on RH Enterprise Linux (2.6.9 kernel, smt, Xeon CPU).

  • What are the different ways in accessing the SQL server from NWDS ?

    Hi Experts,
    Can anyone suggest the different ways for accessing the SQL server from NWDS.I also want to know whether any tool is available for accessing SQL server from Webdynpro java application in Netweaver development studio.
    I am currently using JDBC driver for accessing the SQL server from Webdynpro java application in NWDS.
    Regards,
    Krishna Balaji T

    Note - that no internet backup service has been proven to be safe and effective for backing up the iPhoto library - unless you personally have backup uyp an iPhoto library and restored it sucussfuly form one it should not be recommended - a large number of people have lost their photos trying it
    LN

  • How do I share photos and music between different user accounts on the same macbook

    How do I share photos and music between different user accounts on the same Macbook? i.e. I want all to be able to access family photos when logged into their respective accounts. Same goes for the iTunes library. Hope this is possible...
    Thanks!

    To give other users read-only access to your iTunes library, use the Sharing features of iTunes. Sharing works over the local network as well as on the same computer. See the built-in help for details.
    To give others selective access to your iPhoto library, you have the option of using iCloud Photo Sharing, if the privacy implications don't bother you. The images will be stored temporarily on Apple servers.
    If you want to give full read/write access to more than one user, see the support articles linked below.
    iTunes: How to share music between different accounts on a single computer
    iPhoto: Sharing libraries among multiple users
    There is a way to share the library without moving it to a secondary volume. If you really need to do that, ask for instructions.

  • How can I edit multiple clips with different frame rates on the same timeline

    how can I edit multiple clips with different frame rates on the same timeline

    You do not want to edit material from different frame rates on one timeline. You CAN do this, but it is a very bad idea - and this is why.
    Once you establish the sequence frame rate - lets say it is PAL material at 25fps, any material that you drop into the sequence other than 25 fps will have to be changed to play at 25 fps. If the material you add is NTSC (29.97), FCP will DROP 5 frames per sec to bring the frame rate down to 25 fps. Which 5 get thrown away? Every 6th one. This yields a funky cadence that becomes even more complex as as there are also interlaced fields (DV/NTSC is an interlaced format). Oh, and by the way, the image sizes are different as well. DV/PAL has 576 lines of resolution and DV/NTSC has 480. FCP has to scale up the NTSC to fit the PAL frame.
    You do not want FCP adjusting these things on the fly. You want to do a thoughtful (and time consuming) conversion so that you end up with all your material in one format with the best possible image from the conversion process. Compressor can do an adequate job with Frame Controls turned on. The Natress Standards Conversion FCP plugin is another way to go. A third option is to find a post house that can do the conversion for you using a hardware based process.
    The good news is, once everything is in the same format, editing it will be painless and the output process very quick.
    Whatever frame rate/ image size you select, I'd suggest using ProRes for the codec. It is 4:2:2 color and will withstand color correction and composting with much more grace than any variant of DV based codecs.
    Have fun.
    x

  • How can I copy SQL results to different csv worksheets in the same workbook

    Hi all,
    I'm running a series of select statements using SQLPlus and I want the results for each statement to be copied to different worksheets within the same workbook.
    For example, this is what I want: 'select statement 1' is run and spooled to file.csv / worksheet1. When 'select statement 2' is run it is spooled to file.csv / worksheet2. Same csv file but a different worksheet.
    Right now my SQL is creating a seperate csv file for each select statement. Here's an example of my SQL:
    spool c:\TEMP22\App_Eng1.csv replace
    Select A.OBJECTOWNERID||','||B.OBJECTVALUE1
    from PSPROJECTITEM B, PSAEAPPLDEFN A
    Where B.PROJECTNAME = 'PRJETSC342'
    and B.SOURCESTATUS = 2
    and B.TARGETSTATUS = 1
    and B.OBJECTVALUE2 = ' '
    and B.OBJECTTYPE=33
    and A.AE_APPLID = B.OBJECTVALUE1;
    spool off
    Is what I want to accomplish possible? Any ideas? Thanks.

    As far as I know you can't have "worksheets" for .csv files. They are simply comma separated values (a flat file). I would suggest that you generate separate csv files for each of your queries and then create a new xls file and import each csv file as a new worksheet.
    If you want to automate this process, I recommend you read this:
    http://blogs.msdn.com/brian_jones/archive/2005/06/27/433152.aspx

  • Can i play different songs to different airplay speakers at the same time ?

    Can i play different songs to different airplay speakers at the same time ?
    I know you can select the different speakers to play the music to, but wondered if you can also push different music to different speakers at the same time ?
    If not is there a way around this other than going for something like Sonos ?

    I found another solution in this thread http://forums.macrumors.com/showthread.php?t=695360
    Again you need the rogueamoeba guys.

  • Different Page sizes in the same Framemaker Document

    Is there any way in Framemaker to create different page sizes ( say A4 & A3) simultaneously, either as body pages or master pages, in a long, multi-page document ? The long pages (A3 size) will be folded and tucked inside to fit the width of the A4 size page. Is there something obvious that I am missing ?
    -appu g

    Ian,
    Whether the printer adjusts to different page sizes automatically is a function of the printer, not Frame. A number of printers that have feeds for different size sheets will automatically adjust for you, provided you select "automatic" for your page size preference.
    If the PDF is for print, then I wouldn't worry about it either -- set the file up to print with crop marks and print it on your larger sheet size.
    If the PDF is for online customer viewing, I'd probably do the same thing but without crop marks and either:
    * Use Acrobat to crop the small pages out of the larger page size. Although you can add different size pages here and there as required, that's more fiddly and time consuming than cropping sets of pages in batch mode.
    or
    * let the reader use their copy of Acrobat Reader to set the magnification setting -- the default setting is "automatic."
    Art

  • I used to be able to keep my finger on a key to select an accent in mountain lion but I cannot do the same thing in Maverick.  Any suggestions?

    I used to be able to keep my finger on a key to select an accent in mountain lion but I cannot do the same thing in Mavericks.  Any suggestions?

    I found the following info at file:///Users/gordondoyle/Desktop/Mac%20OS%20X%20Tips.webarchive
    Here’s yet another iPhone feature that has cropped up on the Mac in Lion. While typing, simply pressing and holding on a key will bring up a popup showing all the possible diacritics (accents, cedillas, etc.) that can be added to the letter. You can then choose from the possibilities by pressing the corresponding number on your keyboard, or by clicking the one you want.
    This seems to be a fairly quick way typing accents, and is much easier to use than the old method which involved remembering a number of Option key combinations. It does have one drawback however — it stops you from pressing and holding to write a long line of repeated letters, like thiiiiiiiiiiiiiiiis.
    If you don’t regularly type accents, then losing the repeated character functionality might not be worth it for you. In this case, you can disable this new feature using a Terminal command. Open up Terminal (located in Applications/Utilities), paste the following line and press Return.
    defaults write -g ApplePressAndHoldEnabled -bool NO
    You will need to restart each application for the changes to take effect. Simply repeat the command with YES at the end to reverse.
    and it seems to be related to your suggestion that I follow the threads related to the link you provided except that the above info is the reverse of what I think that I need to do.  I will try what is shown in the threads however and see what happens - most appreciatively!

Maybe you are looking for

  • Error 7 with Report Generation Toolkit

    Hello Everyone, I'm trying to generate an Excel sheet report for some readings using "Report Generation toolkit" But when trying to generate the report, the report generation part of code is executed and gives Error(7) and there is no report is gener

  • Openoffice 3 beta and devel -- what's the difference?

    There are now two different ooo3 packages in extra -- devel and beta. What's the difference? Bleeding-edge vs. stability? It also seems that the beta package takes the user configuration from ~/.openoffice/3/user, whereas the devel package uses ~/.op

  • Asking to enter a device password in the access point but I don't have an access point

    I installed the Intel Proseet Wireless Client and upon connection to my Linksys router a wizard comes up asking me to "enter the device password to my access point or external registrar".  It displays an 8 digit number in the device password field. 

  • Design interface is very slow

    Hello, I'm using this beta on a Windows XP SP2 with 1Gb of memory and Intel Core 2 1.86Ghz cpu. The application I created is very basic: has only 2 buttons and nothing else. If I select both of them to drag them in the design view it is really slow.

  • MAC Sync Issue

    Hi, i am using Macbook Pro with OS X 10.6.7. I have downloaded blackberry desktop manager for mac. now when i am trying to sync my Bold 9780 with it, it syncs the calander really well. the issue is with the address book and outlook 2011. when i am tr