Would sorting in UNIX faster than using order by?

Hi all, recently I was trying to optimize a query that returns a million rows. After using explain plan, I found that the 'order by' (3 columns needed) clause contributes to a significant portion of the cost.
I wonder if the process can be speed up by doing the query straight without ordering, then use the UNIX sort command (with the help of other commands, such as sed, awk... etc.) to perform the 'order by' instead. Of course you'll need to supply a whole bunch of strange parameters to sort command to make it work as expected.
But in terms of performance when the result set is huge, which one is faster? 'Order by' or UNIX sort?
Many thanks.

What are you sorting by ?
If it is a date and the output formats it with a 'Mon' component, then I'd bet on Oracle rather than any user written logic converting JAN to 01 etc.
As for the rest of it, it may depend on the memory allocated to the processes (so PGA setting may improve query performance). A million rows would probably require a disk sort, so the location/speed of that file would impact it too.

Similar Messages

  • Any Program to sort by keywords faster than CS-PS6-Bridge For Keyword Search?

    To sort by keywords in (CS-PS6)-Bridge  one has to group all your folders under one overall folder. Then when you search by keywords (CS-PS6)-Bridge opens up all the photos in Bridge which take  avery long time. Since Lightroom Smart Previews open up smaller files will it open up all ones pictures faster? and then can it sort by keywords.
    I am assuming Lightroom  smart preview opens up a larger size file than CS6-PS-6-Bridge and thus is even slower.
    So the question becomes are there Any Program to sort by keywords faster than CS-6-Bridge For Keyword Search? i.e A program that doesn't have to open up a file to look at keywords or a way to open smaller thumbnails in Bridge?

    Really?
    You mean you can't just click on the Magnifying Glass in the Search Box like I can?
    Uploaded with plasq's Skitch!
    And then Select Rating?
    Uploaded with plasq's Skitch!
    And then click on the Third Dot and it will become a Star?
    Uploaded with plasq's Skitch!
    Or even use a Smart Album? File -> new Smart Album: My Rating -> is -> And there's click on the third dot to make it a star trick again?
    Regards
    TD

  • Is this logging code faster than using a standard logging API like log4J

    is this logging code faster than using a standard logging API like log4J or the logging API in java 1.4
    As you can see my needs are extremely simple. write some stuff to text file and write some stuff to dos window.
    I am thinking about using this with a multi threaded app. So all the threads ~ 200 will be using this simultaneously.
    * Tracer.class logs items according to the following criteria:
    * 2 = goes to text file Crawler_log.txt
    * 1 = goes to console window because it is higher priority.
    * @author Stephen
    * @version 1.0
    * @since June 2002
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.text.*;
    class Tracer{
    public static void log(int traceLevel, String message, Object value)
    if(traceLevel == 1){
    System.out.println(getLogFileDate(new Date()) +" >" + message+ " value = " + value.toString()););
    }else{
    pout.write(getLogFileDate(new Date()) +" >" + message + " value = " + value.toString());
    pout.flush();
    public static void log(int traceLevel, String message )
    if(traceLevel == 1){System.out.println(message);
    }else{
    pout.write(message ) ;
    pout.flush();
    //public static accessor method
    public static Tracer getTracerInstance()
    return tracerInstance;
    private static String getLogFileDate(Date d )
    String s = df.format(d);
    String s1= s.replace(',','-');
    String s2= s1.replace(' ','-');
    String s3= s2.replace(':','.');
    System.out.println("getLogFileDate() = " + s3 ) ;
    return s3;
    //private instance
    private Tracer(){
    System.out.println("Tracer constructor works");
    df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
    date = new java.util.Date();
    try{
    pout = new PrintWriter(new BufferedWriter(new FileWriter("Crawler_log"+getLogFileDate(new Date())+".txt", true)));
    pout.write("**************** New Log File Created "+ getLogFileDate(new Date()) +"****************");
    pout.flush();
    }catch (IOException e){
    System.out.println("**********THERE WAS A CRITICAL ERROR GETTING TRACER SINGLETON INITIALIZED. APPLICATION WILL STOP EXECUTION. ******* ");
    public static void main(String[] argz){
    System.out.println("main method starts ");
    Tracer tt = Tracer.getTracerInstance();
    System.out.println("main method successfully gets Tracer instance tt. "+ tt.toString());
    //the next method is where it fails - on pout.write() of log method. Why ?
    tt.log(1, "HIGH PRIORITY");
    System.out.println("main method ends ");
    //private static reference
    private static Tracer tracerInstance = new Tracer();
    private static Date date = null;
    private static PrintWriter pout = null;
    public static DateFormat df = null;
    }

    In general I'd guess that a small, custom thing will be faster than a large, generic thing with a lot of options. That is, unless the writer of the small program have done something stupid, og the writer of the large program have done something very smart.
    One problem with java in this respect is that it is next to impossible to judge exactly how much machine-level processing a single java statement takes. Things like JIT compilers makes it even harder.
    In the end, there is really only one way to find out: Test it.

  • Why would oracle 9i drivers faster than oracle 10g drivers against a 10g?

    I'm skeptical of the claim but we have a system at work and tests have been done that apparently is showing that the older oracle 9i thin jdbc driver is performing a fetch faster than the 10g driver. This for a query that is currently doing a full table scan.
    Is there a default setting in 10g vs 9i that can explain why the perceived query performance is faster with the older thin driver?

    steffi2 wrote:
    What was observed was that when they started using the old Oracle 8.1.7 8i client jar against this 10g data the actual execution plan changed dramatically to use indexes where was previously it was not doing so and it was doing a full tablescan.
    Why would the introduction of the old 8i jar have this affect?Maybe the test is flawed. For example one test was run with the network was loaded while the other wasn't. Or different connection parameters.
    That said I believe somewhere the claim has been made that Oracle drivers changed from one API to another somewhat recently. Thus that could be the source.
    Or maybe something to do with hints.

  • How can i sort out the N lowiest elements from an 1D array faster than using the build in sort function (1D-array) in Labview?

    I need an algorithm that is based on the same sorting-algorithm that Labview uses (or one that is just as fast) but it only needs to sort out the N lowiest elements (and the N-element output array don't need to be sorted).
    /Jonas

    I want all three zeros in the output. You can se the algorithm that I'm looking for as a soft version of Labviews own sort algorithm that only gives you the N (always less then the length of the array) lowiest values as output.If two elements contain the same small value both should be sorted out.
    /Jonas

  • Why would Tx Required be faster than TxNotSupported?

    I have a stateless session bean that exposes a business method which calls another stateless session bean's worker method many times. Both beans use container-managed transactions and are deployed in a WL8.1 server.
              All methods of both beans were originally configured using the "*" wildcard with a trans-attribute of Required. Since this business method is a report-ish method that doesn't change data in any way, I thought I'd speed it up a bit by removing the requirement for a transaction. I did this by adding additional container-transaction tags for the business method and the worker method that use trans-attributes of NotSupported and Supports respectively.
              But instead of running faster, the business method takes about 3 times longer than when transactions were required.
              Something is obviously amiss but I'm not sure where to look. Any suggestions?
              Thanks.

    Ed MacDonald wrote:
              > I have a stateless session bean that exposes a business method which calls another stateless session bean's worker method many times. Both beans use container-managed transactions and are deployed in a WL8.1 server.
              >
              > All methods of both beans were originally configured using the "*" wildcard with a trans-attribute of Required. Since this business method is a report-ish method that doesn't change data in any way, I thought I'd speed it up a bit by removing the requirement for a transaction. I did this by adding additional container-transaction tags for the business method and the worker method that use trans-attributes of NotSupported and Supports respectively.
              >
              > But instead of running faster, the business method takes about 3 times longer than when transactions were required.
              >
              > Something is obviously amiss but I'm not sure where to look. Any suggestions?
              >
              > Thanks.
              Hi. If the DBMS work is done within a transaction, it is most likely that a single pool
              connection is reserved and transparently used for all JDBC in the transaction. However,
              if they are all non-transactional, all the beans will obtain their own connection, and
              if you have the pool set to test-on-reserve, this will happen for each connection reserve.
              Joe

  • Bummed UK pre-orders on 6/17 shipping faster than US orders (MINE) on 6/16

    Super bummed that Apple is sending out units to people who ordered a full 24 hours after I did. I have been checking hourly only to see the dreaded "Not Yet Shipped" and at the same time I see posts from lucky UK persons who's iPhones have. I hope Apple is going to get these phones to us earlier than JUNE 15-19! P.S. where are all the phones from the canceled pre-orders going? I have seen a ton of postings from people who were able to walk in at Apple and AT&T stores get an iPhone and cancel their order!

    compwiz1202 wrote:
    No he's saying it should be first in first out, and I agree.
    I would have to agree. I don't think anyone should be able to walk into an AT&T, Best Buy or Wal-mart to purchase a new iPhone until ALL pre-orders have been filled. It just doesn't make any sense to me that Apple is shipping out supplies to retailers when there are still so many people waiting for their new iPhones that were pre-ordered before the official release date. Just my 2 cents!!!

  • Interesting Sort using ORDER BY

    I would like to sort by footnote names in our table which should be sorted as below:
    2a,2b,2c,3a,3b,3c,8,10,15,18
    When I use ORDER BY FOOTNOTE_NAME, Oracle sorts the result like this:
    10,15,18,2a,2b,2c,3a,3b,3c,8
    which is not what I want.
    Any ideas. Will I need to strip characters, convert the remaining part to Int and then sort. Does Oracle let you specify your own sort rules?
    Thanks in advance.

    Assuming that the footnote names only have letters and numbers, then something like:
    SQL> SELECT * FROM t;
    COL
    2a
    2b
    3b
    3c
    8
    15
    18
    3a
    2c
    10
    SQL> SELECT * FROM t
      2  ORDER BY TO_CHAR(TRANSLATE(UPPER(col),'1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ',
      3                                      '1234567890'),'0000')||
      4           TRANSLATE(UPPER(col),'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890',
      5                              'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
    COL
    2a
    2b
    2c
    3a
    3b
    3c
    8
    10
    15
    18TTFN
    John

  • Unable to bootup after Yosemite install. have to keep shutting down from rear button. it does come on after a few times but then hangs at user login again. If you get in it is great. Seems faster than Mavericks but there is some sort of issue, bouts

    unable to bootup after Yosemite install. have to keep shutting down from rear button. it does come on after a few times but then hangs at user login again. If you get in it is great. Seems faster than Mavericks but there is some sort of issue, bootup /login.

    Knock on wood, this seems to have been my problem as well.  I stumbled on this thread after dealing with this ridiculously-long boot times for the past several weeks.
    I just reinstalled McAfee Antivirus and my Macbook Air booted up in less than 1 minute.  No more hanging on the boot-up progress bar.  No more hanging after I click on my user's avatar on the log-in screen.  Bootup would often take 5+ minutes and sometimes never complete.
    This has been SUPREMELY frustrating.
    THANK YOU SO MUCH FOR POSTING YOUR RESPONSE!!!

  • Ubuntu is booting up faster than Arch on my computer why would that be

    So after about a year with ubuntu and just trying out different distros i went towards a challenge, Arch. Well it was for me at the time but after installing arch and learning how it all got built i am very content with this new distro for me. My primary objective was to have a really fast distro, thus Arch but since i am a noob for now I dont know all of the ins and outs of it yet. Right now Ubuntu boots up WAY faster than Arch does on my desktop and I would like to know why and how i can change that.

    Arch doesn't do anything to increase boot time other than the ability to background some daemons on startup. There are initscript replacements like quick-init or finit-arc but in my experience they are a little flaky.
    Ubuntu, IIRC, uses upstart which does some things (I don't know) to help increase boot time. You can try installing upstart on Arch if you want http://aur.archlinux.org/packages.php?ID=24506

  • Sorting of Date field in the SQL Query useing ORDER BY

    Hi
    I am facing a problem when I am getting the results of a query from the ORacle 8i database using jdbc connection.
    The query is having a date field and I have to sort the query results using ORDER By for the Date field. The query is giving exact results in the SQL PLus interface.
    When I am getting this results in the GUI where servlets are being used an Exception is coming as not supported RefreshRow method.
    If anyone has faced this problem and have got the solutions please let me know.
    thanks
    sulfy

    That doesn't sound at all like an SQL problem.
    More like you trying to do updates on the resultset which is not allowed ...
    send a some code (not to much pls :) and we'll be
    able to help more
    cu
    Spieler

  • Firefox 4 is not compatible with the skin i had been using for my browser, old factory black... i would prefer to keep this skin rather than use firefox 4... how can i revert back to the previous version of firefox?...

    ''Duplicate post, continue here - [https://support.mozilla.com/en-US/questions/816154]''
    firefox 4 is not compatible with the skin i had been using for my browser, old factory black... i would prefer to keep this skin rather than use firefox 4... how can i revert back to the previous version of firefox?...

    Older versions of Firefox are available here:
    http://www.mozilla.com/en-US/firefox/all-older.html

  • Are the brushes in Photoshop CC faster than CS6 - still need to use CS5 for large files

    Hey,
    Are the brushes in Photoshop CC any faster than Photoshop CS6.
    Here's my standard large file, which makes the CS6 brushes crawl:
    iPad 3 size - 2048 x 1536
    About 20-100 layers
    A combination of vector and bitmap layers
    Many of the layers use layer styles
    On a file like this there is a hesitation to every brush stroke in CS6. Even a basic round brush has the same hesitation, it doesn't have to be a brush as elaborate as a mixer brush.
    This hesitation happens on both the mac and pc, on systems with 16 gb of ram. Many of my coworkers have the same issue.
    So, for a complicated file, such as a map with many parts, I ask my coworkers to please work in CS5. If they work in CS6 I ask them to not use any CS6 only features, such as group layer styles. The only reason why one of them might want to use CS6 is because they're working on only a small portion of the map, such as a building. The rest of the layers are flattened in their file.
    Just wondering if there has ever been a resolution to this problem...or this is just the way it is.
    Thanks for your help!

    BOILERPLATE TEXT:
    Note that this is boilerplate text.
    If you give complete and detailed information about your setup and the issue at hand,
    such as your platform (Mac or Win),
    exact versions of your OS, of Photoshop (not just "CS6", but something like CS6v.13.0.6) and of Bridge,
    your settings in Photoshop > Preference > Performance
    the type of file you were working on,
    machine specs, such as total installed RAM, scratch file HDs, total available HD space, video card specs, including total VRAM installed,
    what troubleshooting steps you have taken so far,
    what error message(s) you receive,
    if having issues opening raw files also the exact camera make and model that generated them,
    if you're having printing issues, indicate the exact make and model of your printer, paper size, image dimensions in pixels (so many pixels wide by so many pixels high). if going through a RIP, specify that too.
    etc.,
    someone may be able to help you (not necessarily this poster, who is not a Windows user).
    a screen shot of your settings or of the image could be very helpful too.
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • I have more than 5 computers in my family and would like to know if I  use the same I'd?

    I have more than 5 computers in my family and would like to know if I  use the same I'd?

    Welcome to the Apple Community.
    You can authorise up to 5 computers for one ID.

  • Is using Math.pow faster than multiplying myself?

    Hi all,
    Is it faster to use Math.pow to calculate a power than to, say, multiply it myself in a loop? How about if I'm just doing a square -- is it faster to use Math.pow(x,2) than x * x?
    I noticed that the pow method in StrictMath has the keyword "native." Does this mean it's being done by the operating system? Does it mean it's being done directly in the hardware?
    Thanks!
    Tim

    TimQuinn wrote:
    This is in an inner-loop deep in a simulation, so I'd like it to be as fast as possible. From the above, I'm gathering that I should keep using pow for my ^8 calculation, but substitute a simple multiplication for my ^2 calculation.Not necessarily. Remember that N^8 = ((N^2)^2)^2. The Math.pow algorithm will very likely use this optimization, but you can too.
    Related question: does it make any difference at all in these kinds of operations if I use floats or doubles? In terms of speed, I mean, not precision.Actual answer to all of your questions: try all of the possibilities in your simulation and see what actually happens.

Maybe you are looking for

  • Inconsiste​nt Parallel Loop Performanc​e

    My original question was can traditional DAQ devices run in parallel loops? I have some extensive data processing and additional automation that would be a lot easier to do in parallel with an acquisition loop rather than cram it all into the acquisi

  • How to create a Crystal Report to connect to Oracle

    Hi, When I create a Crystal report to connect to SQL Server, I create a stored procedure to get all data I need and connect to it from Crystal Report.(In the stored procedure, I created temp tables, used cusor etc to run data.) But now I need to use

  • Function Module for Active Period for PERNR

    Hi gurus, I need a function module to calculate the number of active days within a given BEGDA ENDDA for a PERNR. We get the Status of a PERNR from IT0000 where STAT2 = 3. Regards

  • Archlinux dual monitor without Xorg/Xwindows (cli only)

    Hi, i have successfully installed Archlinux on my laptop, everything is fine!  Xcfe desktop env. is able to handle dual monitor with the "xinerama" option (move windows between screens) with the "/etc/X11/xorg.conf/10-monitor.conf" config. file. But,

  • Change of country for my itunes/app store account

    I have moved to the US and want to change my account to the US.  It says that my apple ID is only valid for purchases in the UK.  How do I change this?  I have changed the flag at the bottom of the itunes store, but that hasn't helped.