Can function in join reduce the performace.

hi,
   i have a function fn_oneortworow it accepts one parameter.
i have used it in left join as follows
1)
select * from T
left join fn_oneortworow(@a) a on a.id=t.id
my fear is that it may execute as many times as many rows are there in table "T"
so i have made the query as follows
2)
select * into #temp from join fn_oneortworow(@a)
select * from T
left join #temp a on a.id=t.id
Q1)please tel me that is it correct that in first query function will called as many times as many records are ther in table T?
Q2)and is second formulation is good or should i use the first one. (to imporve the performance)
yours sincerely

It probably will call the function only once.  Since you are always calling it with the same parameter value, SQL knows the the function will always return the same result.  It is easy to check by looking at the estimated execution plan, that will
tell you how many times SQL believes it will be called.
Nevertheless, even if it is only called once, I would still do the temp table and load the table with a function call.  Then you know for sure the function is only called once.
In addition, if the function can return a lot of rows and id can be a primary key to to #temp table, I would explicitly declare the #temp table with id as a primary key.  That will make the join much faster if #temp has many rows.  And if id is
not a suitable primary key, but #temp has lots of rows, I would create an index on id to speed up the join.
But the only way to know for sure is to run the possible choices with a realistic set of data and see which method is best.
Tom

Similar Messages

  • I've exported my pages graphics document as a PDF file and can't seem to reduce the file size without compromising the quality of the photo's used even after choosing "best" quality.  I'm trying to send the file via e-mail but it's too big.  ??????

    I am trying to e-mail a graphics pages document I made as a PDF file.  After trying to resize the file, the photo's quality is compromised (really blurry) even after choosing "Best" quality.  What am I doing wrong.  As a regular full sized file (PDF) it's fine, but when it gets reduced, it's bad and it needs to get printed from the e-mail copy I'm trying to send.  HELP! Please.

    If there are a lot and/or large images the file will inevitably be large, no matter what.
    You can reduce them down as far as possible by cropping and scaling them to the final size before creating the pdf. You can do this by opening the images in Preview .app and using Menu > Tools to reduce the resolution and to crop.
    If you have used transparency effects eg shadow, reflection, transparency, 3D charts, OSX will by default render these at 72dpi in the pdf.
    Peter

  • Promotions are over. What can I do to reduce the higher cost?

    I'm a new customer to AT&T and love the service.  My area was basically a monopoly and couldn't wait to get a new service when AT&T became available.  As a new user my promotion was $117 a month.  I got U300 and 18mbps internet.   Now the promotions are over and my bill hiked up over $60 more a month.  I reduced the package down to U200.  There really isn't an internet option that will reduce my bill in any significant way.  Even at the lowest speed my bill is about $45 a month higher than in the promotion period.  Now my old carrier is offering more channels and double the internet speed for a little more than my promotional price but less than the retail i'm paying now.   And thats not even on a promotional basis with them.  Problem is I hate their service.  Has anyone had any luck getting a promotional price or around that price for the regular service?

    There's a few different options. Play the retentions game every few months although some reports are that they're less likely nowadays to reduce price, but they'd much rather up your packages for no extra fees.
    The other option, as said, is to reduce your internet speed. Unless you're into heavy gaming or internet video use (Skype, Periscope, etc.) the 12.0 should be good... true, it's advertised as that, but a lot of subscribers to that tier have been reporting closer to 15.0Mbps.
    You can also reduce your TV package to U-200. A lot of movie channels go on "free preview weekend" during the weekend that a big-name series premiers a new season. Record what you want and then watch it after the free previews end. If you're into the series, call up the day before the series has its second episode and get one month of the movie pack for free. In addition, sites like freepreview.tv will promote free previews...duh.
    When that free month ends, cancel the movie package subscription. The next week (or week after), call back for another go-round...if they won't give it to you, pay the rest of the season.
    The Movie Package (includes all movie channels except for EPIX, HBO and Cinemax) seems to give out free previews fairly regularly. HBO/Cinemax are a bit stingy...usually one preview of three months per year, although you may be able to get around this by getting three months free and then upgrading from U-300 to U-450 free for free months.
    For example: Say a new season premiers on Sunday the first on Starz. They should offer a free preview that weekend. Watch the first episode on the free preview. On Saturday the 7th of March, call up and get three months of the Movie Package for free. On June 6th, call up and cancel the Movie Package. On the 14th or 15th, call up and repeat it.
    Another hint... do your research on what other companies in your area are offering you to switch to their service. When you reach the retentions office, quote those offers.
    If you do your work, they'll usually give you a deal...but you gotta work at it.
    Remember to be nice when you're on the phone with them...it goes a long way.

  • How can I change or reduce the line spacing to single in a "multiple lines of text" column in a list?

    We keep many logs in a simple list format. One of the columns requires a description using the "multiple lines of text" default column. Sometimes the person making the entry needs to complete about 20-30 lines of text. Users are requesting we reduce
    the amount of space advanced between lines to save space and be more concise. Is there a way to reduce the line spacing for the column entries to single spacing without code?
    Maree N Percival

    We determined that the site column settings were incorrect for allowing single spacing, we changed the site column setting from "Enhanced rich text (Rich text with pictures, tables, and hyperlinks)" to  "Rich text (Bold, italics, text alignment, hyperlinks)"
    and it is now keeping the text in single spaced lines.
    <label for="onetidRichText">Specify the type of text to allow:</label> 
    <input id="onetidRichTextPlain" name="RichText" title="Plain text" type="radio" value="PLAIN" />
    <label for="onetidRichTextPlain">Plain text   </label>
    <input id="onetidRichTextCompatible" name="RichText" title="Rich text (Bold, italics, text alignment, hyperlinks)" type="radio" value="COMPATIBLE" />
    <label for="onetidRichTextCompatible">Rich text (Bold, italics, text alignment, hyperlinks)</label>
    <input id="onetidRichTextFullHtml" name="RichText" title="Enhanced rich text (Rich text with pictures, tables, and hyperlinks)" type="radio" value="FullHtml" />
    <label for="onetidRichTextFullHtml">Enhanced rich text (Rich text with pictures, tables, and hyperlinks)</label>
    Maree N Percival

  • How can Oracle ERP system reduce the total cost of ownership

    i have read a report that describe the advantages of using Oracle ERP system in different organizations ; it is mentioned that
    "+Oracle’s ERP solution suite helps customers achieve 30-80% lower total cost of ownership, benefit from a predictable cost model, and reduce risk+".
    So does this means that Oracle ERP system reduce the total cost of ownership because it provides cheaper price comparing to other ERP providers, or it is meant that using Oracle ERP system will reduce the total cost of ownership for other assets in the organization by 30-70% ?
    Thanks

    My thoughts:
    1) Oracle ERP (or any ERP) typically replaces numerous applications. Each of those applications needed separate licensing fees, separate support mechanism, and separate employees in your organization to support them. By consolidating into one, it is easier to support it.
    2) Normally, Oracle ERP is cheaper than SAP but it certainly not the cheapest ERP in the market. There are some smaller ERPs which are cheaper but may not offer the breadth that Oracle offers. In fact, Oracle offers a small business ERP that is quite cheaper than EBS.
    Sandeep Gandhi

  • When I open some websites the site is huge. The image is massive and I can figure how to reduce the size.

    When I use Firefox some websites are huge. If I use explorer the size is normal. For example Facebook.

    Reset the page zoom on pages that cause problems: <b>View > Zoom > Reset</b> (Ctrl+0 (zero); Cmd+0 on Mac)
    * http://kb.mozillazine.org/Zoom_text_of_web_pages

  • The two classes are similar,who can help me to reduce the duplicate code

    /./DoubleFilter Class
    public class DoubleFilter {
        private Vector data = null;
        private String symbol = null;
        private Vector filterData = null;
        public DoubleFilter(Vector _data, String _symbol) {
            data = _data;
            symbol = _symbol;
            filterData = new Vector();
        public Vector filter(Double _value){
            if(_value==null){
                return null;
            if(symbol.equals(Symbol.LESS)){
                return less(_value);
            }else if(symbol.equals(Symbol.GREATER)){
                return greater(_value);
            }else if(symbol.equals(Symbol.EQUAL)){
                return equals(_value);
            }else if(symbol.equals(Symbol.NOT_EQUAL)){
                return notEquals(_value);
            }else if(symbol.equals(Symbol.NOT_LESS)){
                return notLess(_value);
            }else if(symbol.equals(Symbol.NOT_GREATER)){
                return notGreater(_value);
            }else{
                return null;
        private Vector less(Double _value) {
            for (int i = 0; i < data.size(); i++) {
                Double baseValue = (Double) data.get(i);
                if (baseValue.compareTo(_value) < 0) {
                    filterData.add(data.get(i));
            return filterData;
        private Vector greater(Double _value) {
            for (int i = 0; i < data.size(); i++) {
                Double baseValue = (Double) data.get(i);
                if (baseValue.compareTo(_value) > 0) {
                    filterData.add(data.get(i));
            return filterData;
        private Vector equals(Double _value) {
            for (int i = 0; i < data.size(); i++) {
                Double baseValue = (Double) data.get(i);
                if (baseValue.compareTo(_value) == 0) {
                    filterData.add(data.get(i));
            return filterData;
        private Vector notLess(Double _value) {
            for (int i = 0; i < data.size(); i++) {
                Double baseValue = (Double) data.get(i);
                if (baseValue.compareTo(_value) <= 0) {
                    filterData.add(data.get(i));
            return filterData;
        private Vector notGreater(Double _value) {
            for (int i = 0; i < data.size(); i++) {
                Double baseValue = (Double) data.get(i);
                if (baseValue.compareTo(_value) >= 0) {
                    filterData.add(data.get(i));
            return filterData;
        private Vector notEquals(Double _value) {
            for (int i = 0; i < data.size(); i++) {
                Double baseValue = (Double) data.get(i);
                if (baseValue.compareTo(_value) > 0
                        || baseValue.compareTo(_value) < 0) {
                    filterData.add(data.get(i));
            return filterData;
    //IntegerFilter Class
    public class IntegerFilter {
        private Vector data = null;
        private String symbol = null;
        private Vector filterData = null;
        public IntegerFilter(Vector _data, String _symbol) {
            data = _data;
            symbol = _symbol;
            filterData = new Vector();
        public Vector filter(Integer _value) {
            if (_value == null) {
                return null;
            if (symbol.equals(Symbol.LESS)) {
                return less(_value);
            } else if (symbol.equals(Symbol.GREATER)) {
                return greater(_value);
            } else if (symbol.equals(Symbol.EQUAL)) {
                return equals(_value);
            } else if (symbol.equals(Symbol.NOT_EQUAL)) {
                return notEquals(_value);
            } else if (symbol.equals(Symbol.NOT_LESS)) {
                return notLess(_value);
            } else if (symbol.equals(Symbol.NOT_GREATER)) {
                return notGreater(_value);
            } else {
                return null;
        private Vector less(Integer _value) {
            for (int i = 0; i < data.size(); i++) {
                Integer baseValue = (Integer) data.get(i);
                if (baseValue.compareTo(_value) < 0) {
                    filterData.add(data.get(i));
            return filterData;
        private Vector greater(Integer _value) {
            for (int i = 0; i < data.size(); i++) {
                Integer baseValue = (Integer) data.get(i);
                if (baseValue.compareTo(_value) > 0) {
                    filterData.add(data.get(i));
            return filterData;
        private Vector equals(Integer _value) {
            for (int i = 0; i < data.size(); i++) {
                Integer baseValue = (Integer) data.get(i);
                if (baseValue.compareTo(_value) == 0) {
                    filterData.add(data.get(i));
            return filterData;
        private Vector notLess(Integer _value) {
            for (int i = 0; i < data.size(); i++) {
                Integer baseValue = (Integer) data.get(i);
                if (baseValue.compareTo(_value) <= 0) {
                    filterData.add(data.get(i));
            return filterData;
        private Vector notGreater(Integer _value) {
            for (int i = 0; i < data.size(); i++) {
                Integer baseValue = (Integer) data.get(i);
                if (baseValue.compareTo(_value) >= 0) {
                    filterData.add(data.get(i));
            return filterData;
        private Vector notEquals(Integer _value) {
            for (int i = 0; i < data.size(); i++) {
                Integer baseValue = (Integer) data.get(i);
                if (baseValue.compareTo(_value) > 0
                        || baseValue.compareTo(_value) < 0) {
                    filterData.add(data.get(i));
            return filterData;
    }

    additionally I'd remove all but one of the for-loops and call a filter() method on a Filter object that chooses wether to select this item or not
    public interface Filter {
      public boolean select(Object o);
    public abstract class ComparableFilter {
      private Comparable base;
      public ComparableFilter(Comparable base) {
        this.base=base;
    public class EqualComparableFilter {
      public EqualComparableFilter(Comparable base) {
        super(base);
      public boolean select(Object o) {
        return base.compareTo(o) == 0;
    }

  • How can I reduce the file size when PDF Optimizer does not do much?

    I have a PDF form that exists of 48 pages. 44 pages are forms / have form fields, the other 4 are just informative. Each form-page has approx. 80 fields (checkboxes, text fields).
    When I started setting up the PDF form the file size was 12 MB and I had placed fields on 21 pages. Then with 34 pages the file size was 19 MB. And with 40 pages it was 35 MB big! Finally with 44 pages the file size is 34 MB.
    So I searched with Google and found some tips. Using the "PDF Optimizer" option inside Acrobat for example. So I did, and the file was reduced only with 3 MB... 31 MB was the file. Also used the option "Save as.... Optimized".... no difference. I also found a suggestion about removing embedded fonts. Using the "Audit Space Usage" option I noticed the fonts taking many MegaBytes:
    * Content Streams: 5.287.000     15,09 %
    * Fonts:                24.556.810     70,08 %  !!
    * Acrobat forms:      3.349.164    12,05 %
    In the older PDF version (I saved and kept this one too) with just 21 pages with form-fields, the  "Audit Space Usage" shows:
    * Content Streams: 5.292.000     40,14 %
    * Fonts:                 1.290.224     9,79 %
    * Acrobat forms:      1.588.758    12,05 %
    So I could save many many MegaBytes by -UnEmbedding- fonts. But if I do this (unembed ALL fonts), the file size stays almost the same!?!?!? Why? What can I do to reduce the file size? I would like it to be 8 MB if possible (32 MB -  24 MB = 8 MB)?
    Thank you for your help!

    If you have authored the form, reduce the number of different fonts for the content and form fields.
    Any font used in a form field will cause that font to be embedded into the PDF.
    If you are going to Optimize the PDF be very careful with forms. Optimization does a lot of removal of items and rearranging of items which can really mess up forms.

  • How do I reduce the file size of a pdf to email?

    I have a 260 MB pdf file generated from Photoshop 6.  I can't seem to reduce the size in Photoshop.  Is there anyway to reduce the pdf outside of Photoshop?  Thanks in advance for any help.

    Hi Scott,
    That's a pretty big PDF! You'll have to reduce it pretty dramatically to attach it to an email. But, you can use Acrobat to reduce the file size. Please see this video for pointers: https://acrobatusers.com/tutorials/how-to-compress-a-pdf-file
    If you don't have Acrobat, you can try it for free for 30 days. For more information, see www.adobe.com/products/acrobat.html.
    Best,
    Sara

  • User Defined Function VS join - Performance....

    Hi All,
    while linking the mulitple table and getting the values ....which one is the best ?
    Joining or User defined function.....
    single row function
    select a.name , get_salary(empid) from emp a;
    Note : get_salary function will return the salary from salary tables.
    Using joins
    select a.name ,b.salary from emp a, salary b
    where a.empid=b.empid;
    which is the performancewise best ?
    also if you give any related document also fine.
    Thanks in advance.
    Edited by: BASKAR NATARAJAN on Jan 6, 2011 10:09 PM

    Don't use such functions for joins. The function itself has to query the salary table. It will run the query against the salary table separately for each row that it reads from the emp table. You will end up with multiple recursive calls and possibly inconsistency in the output. (Imagine what would happen if the salary table were updated and commited while this query was running -- some rows would have been read with the pre-update values and others with the updated values).
    Specifying the join in the query ensures that a single SQL call is executed and provides read consistency across all the rows it reads. And it is much faster, being one single parse and execute.
    Hemant K Chitale
    http://hemantoracledba.blogspot.com

  • SP2013: Can a subsite owner block the site collection owner?

    I read some discussion telling me Sharepoint allow subsite owner can block parent site owner. But in my test, the Site Collection owner ALWAYS have FULL PERMISSION on subsite. Is it true?
    I have tested in my farm. I login as one Site collection owner (A), create a subsite, then break the subsite permission inheritance. Assign someone (B) as subsite owner. Then I login as the subsite owner (B). Remove everyone but me (B) in the subsite
    permission lists.
    However, the SC owner (A) can still change the permission for this subsite. I use "check permission" to check against A. A have every permission although he is not belong to any permission group or permission level.  Is it default behaviour?

    It is true, you can't block or reduce the permissions assigned to the site collection owner.

  • Reducing the size

    Hi all,
    I am interested to know whether is it possible to reduce the size of mymt.zip ? . As java web start at the first instance caches all of the jar and zip files but this size is too huge even for the first time.Can lazy loading help us here ? or is there other way round ? . If some of u knows about this then pls share.
    regards
    Mangesh

    What is contained in this ZIP file? You can use obfuscation to reduce the sizes of class files, also you can make sure your JAR is compressed vs. uncompressed.
    Rob

  • Reduce the processes in vista

    Can someone help me reduce the number of processes running in the background on vista? tell me which ones I can safely disable without harming the system
    http://img79.imageshack.us/img79/865/processwh7.jpg

    Would something like this be a help?
    Also dont forget about the Vista performance document on our support site.
    Ed Shumpert
    Thinkcentre/Desktops Launch Readiness Program Manager
    US Service & Support

  • How can I reduce the width of an Adobe Bridge web gallery in Dreamweaver?

    Hi there,
    I've been created a website using Dreamweaver CS4, which is nearly finished except for the photo gallery.
    I have created the web gallery through Adobe bridge and exported. I then created an iframe within the dreamweaver page and specified that it fills 100% of the space (or column, which is approx 510px wide). I then inserted the index file of the gallery into the iframe though 'modify' > 'Edit tag'.
    I saved and tested the webpage in a browser - the functionality worked but the gallery seems to be cropped (See attached pic).
    I then tried to specify that the iframe was 510px wide, but the gallery remained at the same width and the right side of some images and the scroll bar are missing.
    Does anyone know how to reduce the width of an adobe bridge web gallery to 500px wide and insert succesfully into dreamweaver??
    Many thanks
    Helen

    The original photo gallery is:
    http://www.bethanyjanedavies.com/portfolio.html
    You can see that the right side is chopped off
    But I may have to compromise and use:
    http://www.bethanyjanedavies.com/portfolio2.html
    This is a much wider page than the rest of the website, but I suppose you have to find a compromise that works!!
    Cheers
    Helen

  • How can i reduce the number of calls archived in recents

    How can i reduce the number of calls archived in recents

    You can't change that.  It's a function of the OS and cannot be altered.

Maybe you are looking for