Splitting and executing the query for each 1 lac and executing parallel.

Hi All,
We have a table with around 10 keys and each key is having more than millions of records for a given date.
And my requirement is to find the sum of the sale_price of each keys.
( example :
Select key, sum(sale_price) from table1 where date1=sysdate
group by key
Since, each set of key contains more than a millions of records, It's time consumption is too high.
Is thr any way to achieve as below,
For key 1 (assume 1 million records)
and we will spilt these into 100 parts and execute parallelly.
At the end get sum of all 100 parts.
Similarly for other keys....
Is it possible to divide the records into 1 lac each and give it for parallel execution ?

If the key column is also the partition key, I would expect that to work well with parallel query. What have you tried that isn't working? Also what is your Oracle version?

Similar Messages

  • Issue While executing the Query for Pagination using ROWNUM with like

    Issue While executing the Query for Pagination using ROWNUM with like.
    Database is Oracle11G.
    Oracle Database Table contains 8-9 lakh records
    1) SQL equal (=)
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE A.REFERENCE = 'KMF22600920'
    Execution Time:- 0.00869245 seconds
    Returns 2 resultsets
    2) SQL like (one %)
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE A.REFERENCE = 'KMF22600920%'
    Execution Time:- 0.01094301 seconds
    Returns 2 resultsets
    3) SQL like (two%)
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE A.REFERENCE like '%KMF22600920%'
    Execution Time:- 6.43989658 seconds
    Returns 2 resultsets
    In Pagination, we are using Modified version of SQL Query 3) with ROWNUM as mentioned below :-
    4) SELECT * FROM (
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE REFERENCE like '%KMF22600920%' AND ROWNUM <= 20 ) WHERE RNUM > 0
    Execution Time:- Infinite
    ResultSets:- No as execution time is infinite
    a) Instead of like if we use = in the above query it is returning the 2 resultsets (execution time 0.02699282 seconds)
    b) Instead of two % in the above query, if use one example REFERENCE like 'KMF22600920%' it is returning the 2 resultsets (execution time 0.03313019 seconds)
    Issue:- When using two % in like in the above query i.e. REFERENCE like '%KMF22600920%' AND ROWNUM <= 20 ) , it is going to infinite.
    Could you please let us know what is the issue with two % used in like and rownum
    5) Modified version of Option1 query (move out the RNUM condition AND RNUM <= 20)
    SELECT * FROM (
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE REFERENCE like '%KMF22600920%' ) WHERE RNUM > 0 AND RNUM <= 20
    Execution Time:- 7.41368914 seconds
    Returns 2 resultsets
    Is the above query is best optimized query which should be used for the Pagination or still can improve on this ?

    This would be easier to diagnose if there was an explain plan posted for the 'good' and 'bad' queries. Generally speaking using '%' on both sides precludes the use of any indexes.

  • How can I monitor my monthly data usage for all 3 computers in my house? I have an Airport base station and it seems there should be software to monitor it from that point rather than monitoring the usage for each computer and then adding it up.

    How can I monitor my monthly data usage for all 3 computers in my house? I have an Airport base station and it seems there should be software to monitor it from that point rather than monitoring the usage for each computer and then adding it up.

    The following example was one of dozens that showed up on a simple Google search of.....
    monitor Internet data use on a Mac
    Watch your Internet usage with NetUse Monitor | Macworld
    Most service providers have an application for their users as well.

  • My inbox used to show the sender for each message and now it does not...how do I get it back to where it was?

    My inbox used to show the sender for each message and now it does not...how do I get it back to where it was?

    Right click the heading at the top of the message list and select From from the list of options.

  • Execute a query for each value returned by subquery

    Hy, I have a query and a subquery(both of them are selects) and I want the outer query to be executed for each value returned by the subquery but the outer query has to return only one result.
    For example, the following query is right for what I want?:
    the following query finds out which authors live in the same city by looking at the postal code:
    select au_fname, au_lname, city
    from authors
    where city = all
    (select city
    from authors
    where postalcode like "946%")
    I undertand the sentence "select au_fname, au_lname, city from authors where city=" will be executed for each value returned by "select city from authors where postalcode like "946%"". Is this right?
    Thanks

    Hi,
    user13162080 wrote:
    Hy, I have a query and a subquery(both of them are selects) and I want the outer query to be executed for each value returned by the subquery but the outer query has to return only one result. Sorry, I don't understand what you want. What if several rows in the table meet all the criteria? Do you only want some kind of summary of all of them?
    Whenever you have a question, post a little sample data (CREATE TABLE and INSERT statements), and the results you want from that data.
    For example, the following query is right for what I want?:
    the following query finds out which authors live in the same city by looking at the postal code:
    select au_fname, au_lname, city
    from authors
    where city = all
    (select city
    from authors
    where postalcode like "946%")As I said earlier, I don't know what you want , but whatever it is, the query above is probably not the right way to get it.
    Perhaps you meant "IN" instead of "= ALL", like this:
    SELECT  au_fname, au_lname, city
    FROM      authors
    WHERE      city     IN          -- ***NOT***  = all
              (   SELECT  city
                  FROM    authors
                  WHERE   postalcode LIKE "946%"
    I undertand the sentence "select au_fname, au_lname, city from authors where city=" will be executed for each value returned by "select city from authors where postalcode like "946%"". Is this right?No; the main query will be executed once, and the sub-query will be executed once. The rows in the main query will be compared to the results of the sub-query, to see if they will be included in the result set or not. This goes both for the original query you posted, and the modified version I posted.
    InoL wrote:
    Maybe I don't understand exactly what you want, or you gave a bad example. But your example is simply:
    select au_fname, au_lname, city
    from authors
    where postalcode like '946%'
    No; consider this data:
    INSERT INTO authors (au_lname, city, postalcode) VALUES ('Virgil',     'Oakland',     '94601');
    INSERT INTO authors (au_lname, city, postalcode) VALUES ('Steinbeck',     'Oakland',     NULL);
    INSERT INTO authors (au_lname, city, postalcode) VALUES ('Grass',     'Emeryville',     '94608');What OP posted would return no rows, because nobody is in both 'Oakland' and 'Emeryville'.
    What you posted would return 'Virgil' and 'Grass'.
    What I posted would reutn all 3 rows, including Steinbeck, whose city is known to be related to a '946%' postalcode, even though his own postalcode is missing.
    Edited by: Frank Kulash on Feb 9, 2011 1:06 PM

  • Ungroup a group and keep the scriptlabel for each item of the group

    Hi
    does someone know how to ungroup a group of rectangles with a certain label (example groupA) an give each rectangle a own label (the same text groupA)
    I can find the group and ungroup it but I can't label the rectangles...
    var oPageItems = app.activeDocument.allPageItems;
    for (var j = oPageItems.length-1;  j >= 0; j--) {if (oPageItems[j].label==("groupA")) {oPageItems[j].ungroup();)
    Please help

    Hi,
    before
    oPageItems[j].ungroup();
    go into the loop and set proper label to each item inside group:
    for (var k; k < oPageItems[j].length; k++)
    oPageItems[j][k].label = "groupA";
    assuming your oPageItems[j] is a group indeed.
    hope...

  • How to execute the query for a block based on the parameter

    Hi All,
    Good evening.
    i have requirement where i need to display the data in one block based on the selected items.
    the scenario is like this...there are 2 LOV's and one apply button and one external region on the form.
    so when u select the lov values and click on apply button the query should execute based on this 2 lov values.
    i am not getting how to achieve this..i am very new to oracle forms..
    Please Help..
    Thanks
    Bharat
    please help..it is urgent..
    thanks
    bharat
    Edited by: Bharat on Jan 31, 2012 5:19 AM

    Bharat wrote:
    Hi All,
    Good evening.
    i have requirement where i need to display the data in one block based on the selected items.
    the scenario is like this...there are 2 LOV's and one apply button and one external region on the form.
    so when u select the lov values and click on apply button the query should execute based on this 2 lov values.
    i am not getting how to achieve this..i am very new to oracle forms..Another way you can do this. Create a lov and don't assign it to any column just one return item (should be id).
    Now create a button may be your "apply button" write two trigger when-button-press and when-mouse-click.
    at When -Button-Press trigger, change the block state to 'ENTER-QUERY' and at when-mouse-click show the LOV and then write execute_query.
    Hope this will help you.
    If someone's response is helpful or correct, please mark it accordingly.

  • How do I change the Issurer for each site and what initial entry sets the issuer value?

    Cert Server 4.7; I have many web sites with at least three domains; all accessed through a reverse proxy(s) version 3.4. If I have a site www.cf.com and a site tst.www.cf.com, do they each require a different issurer, namely www.cf.com and tst.www.cf.com or just a common domain name cf.com? If I am using one reverse proxy for two sites - tst.cf.com and dev.cf.com How do I handle the server certificut install?

    Once you have loaded the site into SEO Tool, click the arrow down next to the site name in the left column and then select an HTML file to add the Meta Description to.
    Do this with every HTML files in your website.
    MobileMe is not the best place to publish a website for a number of reasons but you should be OK if you upload your sitemap.xml file to the Web/Sites folder on your iDisk. Upload it using drag and drop. From the Finder Go menu, follow the path iDisk/My iDisk/Web/Sites.
    Info about sitemaps...
    http://www.iwebformusicians.com/SearchEngines/Sitemap.html
    "I may receive some form of compensation, financial or otherwise, from my recommendation or link."

  • How to write the query for year revenue and avg

    Hello Team
    I have the table
    create table sale (sale_id varchar2(32) not null, sale_epoch_microsec numeric(18,0)
          not null, sale_amount_cents numeric(18,0) not null, customer_id varchar2(32)
          not null, industry_id varchar2(32) not null, product_id varchar2(32) not null)The industry the customer is considered to be in can change from sale to sale. sale_epoch_microsec is microseconds since epoch; sale_amount_cents is the value of the sale in pennies.
    The data in this is:
    Insert into SALE
       (SALE_ID, SALE_EPOCH_MICROSEC, SALE_AMOUNT_CENTS, CUSTOMER_ID, INDUSTRY_ID,
        PRODUCT_ID)
    Values
       ('s1', 200000000, 69985484589459, 'c1', 'i1',
        'p1');
    Insert into SALE
       (SALE_ID, SALE_EPOCH_MICROSEC, SALE_AMOUNT_CENTS, CUSTOMER_ID, INDUSTRY_ID,
        PRODUCT_ID)
    Values
       ('s2', 200000000, 69985484589459, 'c2', 'i2',
        'p2');
    Insert into SALE
       (SALE_ID, SALE_EPOCH_MICROSEC, SALE_AMOUNT_CENTS, CUSTOMER_ID, INDUSTRY_ID,
        PRODUCT_ID)
    Values
       ('s3', 6579000000, 6.99675342390895E16, 'c3', 'i3',
        'p3');
    Insert into SALE
       (SALE_ID, SALE_EPOCH_MICROSEC, SALE_AMOUNT_CENTS, CUSTOMER_ID, INDUSTRY_ID,
        PRODUCT_ID)
    Values
       ('s4', 6.5866459684979E17, 6.99675343454391E17, 'c4', 'i4',
        'p4');
          1.) SQL: Write the SQL query to determine, year-over-year, the total revenue and avg. per-product revenue from customers in the 'Gaming' industry.

    josh1612 wrote:
    As in the question it's mentioned that the date is in microseconds,
    So i need the guidence to convert that to the date .Convert microseconds to seconds and then you may be able to use the function below which was found here:
    http://www.oracle.com/technology/pub/articles/oracle_php_cookbook/fuecks_dates.html
    CREATE OR REPLACE
        FUNCTION unixts_to_date(unixts IN PLS_INTEGER) RETURN DATE IS
             * Converts a UNIX timestamp into an Oracle DATE
            unix_epoch DATE := TO_DATE('19700101000000','YYYYMMDDHH24MISS');
            max_ts PLS_INTEGER := 2145916799; -- 2938-12-31 23:59:59
            min_ts PLS_INTEGER := -2114380800; -- 1903-01-01 00:00:00
            oracle_date DATE;
            BEGIN
                IF unixts > max_ts THEN
                    RAISE_APPLICATION_ERROR(
                        -20901,
                        'UNIX timestamp too large for 32 bit limit'
                ELSIF unixts < min_ts THEN
                    RAISE_APPLICATION_ERROR(
                        -20901,
                        'UNIX timestamp too small for 32 bit limit' );
                ELSE
                    oracle_date := unix_epoch + NUMTODSINTERVAL(unixts, 'SECOND');
                END IF;
                RETURN (oracle_date);
        END;

  • Auto  filter settings taking when executed the query for one user id......

    Hi All,
    We are facing one strange issue for  one particular user id  ( i.e for top management) ,when this user executes any of the report  by in putting his own selection parameters say date 15.09.2009 and plant 1111 the output of the report is coming as 15.06.2009 to 19.06.2009 and the plant is also coming as 2222 instead of 1111.
    I have checked it there are variants for this user id .
    When i checked in  the filters in portal it is showing for the cal day15.06.2009 to 19.06.2009,plant 2222,Materials Xyz,Keyfigures say Net amount only, nd more over its getting filtered onalso..... something there is a problem its taking automatic filter values.
    What could be the issue does any one faced this kind of problem?
    Pl help me out by providing your valuable inputs.
    Rgds,
    Rakesh

    closed

  • Table of content, I want to display just the image for each chapter and the name of the chapter. my book is not landscape format but each time I draging a picture into a specific chapter it duplicate it to all chapters why?

    table of content in a landscape orientation.
    I want to have in my table of content only image and the name of the chapter which is each to do.
    my problem when I am draging an image to each chapter it copied it to all chapter although I am marking only the specifc chapter.
    why? how can i overcome it?

    Are you using Microsoft word?  Microsoft thinks the users are idiots. They put up a lot of pointless messages that annoy & worry users.  I have seen this message from Microsoft word.  It's annoying.
    As BDaqua points out...
    When you copy information via edit > copy,  command + c, edit > cut, or command +x, you place the information on the clipboard. When you paste information, edit > paste or command + v, you copy information from the clipboard to your data file.
    If you edit > cut or command + x and you do not paste the information and you quite Word, you could be loosing information.  Microsoft is very worried about this. When you quite Word, Microsoft checks if there is information on the clipboard & if so, Microsoft puts out this message.
    You should be saving your work more than once a day. I'd save every 5 minutes.  command + s does a save.
    Robert

  • My imovie version 10.0.3 won't open. I have tried closing and leaving the computer for a day and still I can't get the application to open. Any thought?

    my iMovie 10.0.3 won't open on my mac. I have tried all the tricks I can think of and it still won't open.
    Any thought?
    thanks..

    Have a look at my posts here and see if it helps:
    https://discussions.apple.com/thread/6271393?tstart=0
    Geoff.

  • Same Query for both Main and Sub Report

    I have a report whichs works but I don't think i'm getting the data to both the Main Report and Sub Report in the most effcient manner...  I have a report that totals users call subject counts.  But then end user wishes to see all users total counts and the grand totals of call counts on the first page then then the breakdown of types of calls on subsuquent pages...  so I created a report with a subreport in the report header....  I use the same query in both the sub and main report... however it asks the user to enter the parameters once for the main report and once for the sub report... Parameters are both the same for each; month and year...  so it currently runs the query twice I want to run it once and use the data for both reports...  I group by name and then sum the call subject counts for the user totals... and in the sub report I hide the detail section and I'm just left with the sub total line for each user, then in the main report use the same grouping and suming again and I start a new page for every user... 
    Using CR 9
    Thanks for any advice
    Vincent

    i think you need to link the main report parameter with the subreport parameters inorder to pass the parameter values from main report to subreport. So right click on subreport and go to change subreport links and add parameter fields and select parameter fields from your subreport and un check the databse fields in subreport.
    Regards,
    Raghavendra.G

  • Strange problem while executing the Query.......

    Hi,
    I have created a new query and I am facing the strange behaviour.
    When I execute it , it works fine but when one of my colleague execute it , it does not return any value for one of the Price variable.
    It works fine with most of the people I have checked except one.
    Can somebody let me know the reason.....?
    Thanks , Jeetu

    Hello,
    If it is authorization problem go to transaction st01 and mark the first check for authorization. Under filter insert the user. Click Trace On.
    Execute the query with that user and just after the lack of authorization message click trace off.
    Read the trace.
    Do the same with your user and compare the log of the two.
    You'll see what is missing.
    Assign points if helpful.
    Diogo.

  • View and the query for the view giving different datasets

    I have a view created with the below syntax.
    CREATE OR REPLACE FORCE VIEW vw_name (/*column names*/ )
    AS SELECT /*column names*/ from tables
    When I execute the query with which the view is constructed , I m getting different data set which contains 4690 rows
    and when I exeute the view I m getting dataset which contains only 4657 rows.
    Can you please explain why the differnce in count when the source for both is the same.

    Can you please explain why the differnce in count when the source for both is the same.Answer should be one of the following
    1. The two query are not same
    2. The table data has been modified
    3. You are seeing at the wrong thing (manual error)

Maybe you are looking for

  • Using 2 i-tunes accounts on one computer

    How can I get 2 i-tunes accounts on 1 Mac? My spouse and I use the same macbook but we want to use our separate i-tunes accounts. Thanks

  • Where is my operating system?

    Before you ask I want to ask forgiveness for my English. I used a translator. I bought a Macbook pro 2011, along with pre-installed OS X Lion. There was no disk with the operating system in a box. When I went into a Mac App Store, I found that OS X L

  • Pick TDS Entries in Outgoing Payment

    Hi, While making Outgoing payment for TDS type, we need to click on Pick TDS Entries, where we get the list of documents where TDS has been deducted but i need a filteration in there because the list is so long to choose the documents against which T

  • FOR SALE - Lenovo Thinkpad Tablet, Docking Station and Keyboard Folio Case

    As my daughter is insisting on a laptop, her Thinkpad Tablet and Accessories will have to go.... The tablet is the 16GB WiFi Version (1838-5SG). The Docking Station is the standard one (0A33965), as is the Keyboard Folio Case (which is a Western Euro

  • Making a pano in PSE from LR4

    I can only send one photo at a time to PSE from LR4. Want to make a pano in PSE. Thanks