Paging query needed help for large table - force a different index

I use a slight modification of the pagination to be completed request to ask Tom: [http://www.oracle.com/technology/oramag/oracle/07-jan/o17asktom.html]

Mine looks like this to extract the first 100 lines of everyone whose last name Smith, ordered by join date:
SELECT members.*
FROM members,
(
    SELECT RID, rownum rnum
    FROM
    (
        SELECT rowid as RID 
        FROM members
        WHERE last_name = 'Smith'
        ORDER BY joindate
    ) 
    WHERE rownum <= 100 
) 
WHERE rnum >= 1 
         and RID = members.rowid
The difference between this and ask Tom is my innermost query returns just the ROWID. Then, in the outermost query we associate him returned to the members table ROWID, after that we have cut the ROWID down to only the 100 piece we want. This makes it MUCH more (verifiable) fast on our large tables, because it is able to use the index on the innermost query (well... to read more).
The problem I have is this:
SELECT rowid as RID 
FROM members
WHERE last_name = 'Smith'
ORDER BY joindate
It will use the index for the column predicate (last_name) rather than the unique index that I defined for the column joindate (joindate, sequence). (Verifiable with explain plan). It is much slower this way on a large table. So I can reference using one of the following methods:
SELECT /*+ index(members, joindate_idx) */ rowid as RID 
FROM members
WHERE last_name = 'Smith'
ORDER BY joindate
SELECT /*+ first_rows(100) */ rowid as RID 
FROM members
WHERE last_name = 'Smith'
ORDER BY joindate
Whatever it is, it now uses the index of the column ORDER BY (joindate_idx), so now it's much faster there not to sort (remember, VERY large table, millions of records). If it sounds good. But now, on my outermost query, I join the rowid with the significant data in the members table columns, as commented below:
SELECT members.*      -- Select all data from members table
FROM members,           -- members table added to FROM clause 
(
    SELECT RID, rownum rnum
    FROM
    (
        SELECT /*+ index(members, joindate_idx) */ rowid as RID   -- Hint is ignored now that I am joining in the outer query
        FROM members
        WHERE last_name = 'Smith'
        ORDER BY joindate
    ) 
    WHERE rownum <= 100 
) 
WHERE rnum >= 1 
        and RID = members.rowid           -- Merge the members table on the rowid we pulled from the inner queries
As soon as I did this join, this goes back to the use of the index of predicate (last_name) and perform the sort once he finds all the corresponding values (which can be a lot in this table, there is a cardinality high on some columns).

My question therefore, in the query full above, is it possible that I can get to use the ORDER of indexing BY column to prevent having to sort? The join is what makes go back to using the predicate index, even with notes. Remove the join and just return the ROWID for these 100 records and it flies, even over 10 millions of documents.

It would be great if there was some generic hint that could accomplish this, such as if we change the table/column/index, do not change the indicator (indicator FIRST_ROWS is a good example of this, while the INDEX indicator is the opposite), but any help would be appreciated. I can provide explain plans for the foregoing, if necessary.

Thank you!

Tags: Database

Similar Questions

  • Update sql need help for hierarchy table

    I'm trying to update the raw field based on each unit Qty is the appearance of the table.

    slevel | Manager | seller | unit_qty | gross Qty


    0 | Mary | Mary | 1. 1


    .1 | Mary | Lynn | 3. null


    .1 | Mary | Betty | 2. null


    .1 | Mary | Alice | 2. null


    .. 2. Alice | Susan | 1. null


    .1 | Mary | Amy | 4. null


    I'd like the table to look like this after the update, with the values

    slevel | Manager | seller | unit_qty | gross Qty


    0 | Mary | Mary | 1. 1


    .1 | Mary | Lynn | 3. 3 * 1 = {color: #ff0000} 3 {color}


    .1 | Mary | Betty | 2. 2 * 1 = {color: #ff0000} 2 {color}


    .1 | Mary | Alice | 2. {color: #008000} 2 * 1 {color} = {color: #ff0000} 2 {color}


    .. 2. Alice | Susan | {color: #0000ff} 1 {color} | {color: #008000} 2 * 1 {color} {color: #0000ff} * 1 {color} = {color: #ff0000} 2 {color}


    .1 | Mary | Amy | 4. 4 * 1 = {color: #ff0000} 4
    {color}
    It is the SQL, I've tried to use unsuccessfully.


    Update table set gross_qty = unit_qty * ({color: #ff0000} select gross_qty from table {color})


    ({color: #ff0000} where Manager = seller {color})


    where slevel & gt; 0

    This is not the same thing?

    UPDATE vendor s1
    SET s1.gross_qty =
    (CASE
    WHEN s1.slevel = 0 THEN s1.unit_qty
    WHEN s1.slevel > 0 THEN
    S1.unit_qty * (SELECT SELLER s2 WHERE s2.client = s1.manager s2.gross_qty)
    (END);

    I wrote here a basis of hierarchical queries:

    http://blog.mclaughlinsoftware.com/hierarchical-queries-basics/

    It could be that useful...

  • I need help for the upgrade of my current system.

    I need help for the upgrade of my current system.

    I have SBS 2008 with (Exch 2007, SQL 2005, Sharepoint, backupexec 2010 for sbs) licenses.

    I want to make the larger environment using the following:

    (1) apply Virtualization

    (2) apply to the failover process (clustering)

    "(3) the environment must support adding server terminal server, ERP server, exchange server, domain controller, backup manager.

    Storage 4) that supports Raid (1 and 5)

    UTM excellent 6) that supports (SSL VPN, VPN Global)

    suitable backup solution 7)

    (8) good antivirus for clients

    my questions:

    (1) can you provide me with a good design for this environment

    (2) should I choose what operating system:

    Microsoft datacenter or company

    I know datacenter provide us the unlimited VM but needs per processor license

    so if I have two Grouped servers I want to buy 4 licenses

    and just 4 VMs per company license... to say that we have two servers and maintain 8 vms so wat happened if 1 goes down... How can I migrate the 4 virtual machines on the server failed to another server group... ? should I buy enterprise license?

    (3) if I get the SAN storage for data... How can I save this storage... should I get another SAN?

    (4) how can I upgrade SBS stad single server (windows standrad) without losing the licenses as Exch 2007, SQL 2005, sharepoint.is it a must to buy an edition full std server or there is a way to upgrade (license wise, I mean)?

    (5) what about win2k8 license for VM:

    lets say we have physical that has windows license so that enough to have windows for VM or should I buy windows for VM licenses?

    (6) can I use backExec license for SBS with windows 2008 standard

    (7) who better to virtualization AMD or INTEL

    (8) hyper V or VMware?

    (9) what of Microsoft data protection Manager... is this good?

    (10) what virtual machine manager? What are the benefites keys

    Thanks in advance

    Hello AnasAI,

    You can find the Server forums on TechNet support, please create a new post at the following link:

    http://social.technet.Microsoft.com/forums/en/category/WindowsServer/

  • Need help for optical safety circuit.

    I buy these parts and prototype with real components, but since I multisim, I thought it would be nice to create the circuit and maybe work through issues I can practically.

    I need a circuit that takes 120 VCA, generates 5 VDC and 1.5Vdc power of optical transmitter and receiver.  I actually use a data port because he has great range and is pretty cheap.  Rather than send the binary code well I just send a light stead that is broken or not broken through doors and windows in my house.  Then the receiver sees this as an entry and order a relay.

    I tried several voltage regulators that come with multisim, but I get an error of execution of my circuit.  Really I can't the 120 VAC to power levels necessary for the functioning of the optics.

    Otherwise I might want to run on a system 120Vdc with battery backup, so throw a 120Vdc up to 20 v DC switching power supply - but I have not found a SMP in the library which takes 120 as input and as output 20.

    Basic plan: 120VAC source-> transform to 24Vac-> Full bridge rectifier to ~ 20 v DC-> voltage capacitor filter on the input of two voltage regulators (1 to 5 VDC, 1 to 1.5Vdc) - then circuit since the two power supply of the transmitter and the receiver.

    I just need help for 5V and 1.5V, from there, I know that the real world circuit will work component tests already carried out.  Thanks for reading.

    I didn't Multism so I can't advise you on the compatible models. I ran the model on semiconductors with slight modifications of format on my SPICE simulator based on Berkeley Spice 3f5. I had to change the format of model resistance semiconductors appeal but has not changed any values.

    The output of your power supply circuit 3 (with 5 V, not the 1.5 V regulator regulator) was 4.99995 V.

    There are a few messages about changing templates published for compatibility Multisim woth. You can search those to see if there are any suggestions on what you'll need to fix in the model.

    Lynn

  • I need help for activation of the real administrator account.

    I have a problem with Adobe reader 9 standard, Adobe customer service asked the unhide real administrator account before you can continue to help me.

    I need help for that.

    http://www.Vistax64.com/tutorials/67567-administrator-account.html

    http://www.howtogeek.com/HOWTO/Windows-Vista/enable-the-hidden-administrator-account-on-Windows-Vista/

    Read the above info.

    See you soon. Mick Murphy - Microsoft partner

  • I need help for my reader to USB drive on my windows 10 ACER?

    I need help for my reader to USB stick on my chrome windows 10 plug ins acer. Can you help me?

    What Adobe application that you use?

    This is the Adobe Media Encoder forum, and you did not mention anything on this subject. If you can let us know what Adobe application, you need help, we can help you make the right forum.

    Thank you

    Regalo

  • Hello, I need help for cancel the payment on my adobe account.

    Hello, I need help for cancel the payment on my adobe account. I'm from Peru, Im paying a monthly fee as a student. Help, please...

    Cancel your membership creative cloud

  • Hello, need help for Adobe Reader DC playing animation files that are specified in the pdf output by script Latex Beamer. My Adobe Reader DC refuse to open any format that I gave him.  Thank you very much

    Hello, need help for Adobe Reader DC playing animation files that are specified in the pdf output by script Latex Beamer. My Adobe Reader DC refuse to open any format that I gave him.  Thank you very much

    Hey ihorl18351266,

    Please note that you can open PDF files using only the CD player. Any other format will not be supported by the software.

    Kind regards

    Ana Maria

  • Need help for query flat_file type clobdata oracle table data.

    Hi Sir,

    I need help to query oracle table flat file data having given clob type.
    Oracle Version:
    
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    PL/SQL Release 10.2.0.1.0 - Production
    "CORE     10.2.0.1.0     Production"
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    
    
    
    Source table
    
      CREATE TABLE order_details 
       (     QUEUE_SEQNUM NUMBER(10,0) NOT NULL ENABLE, 
         LINE_SEQNUM NUMBER(10,0) NOT NULL ENABLE, 
         CHAR_DATA CLOB, 
         OPTIMISTIC_LOCK_KEY NUMBER(20,0)
       ) 
    COLUMN FOR CHAR_DATA FLAT_FILE
    EU,6067AT,AT10,000000402004,NexiumGERDManagementProject,Z435,,ZZ29,NIS-GOLD,AT
    EU,6067AT,AT10,000000402038,NIS-OEU-ARI-2007/1,Z450,,ZZ29,NIS-OEU-ARI-2007/1,AT
    EU,6067AT,AT10,000000402039,SymbicortNISinCOPD,Z450,,ZZ29,NIS-REU-DUM-2007/1,AT
    EU,6067AT,AT10,000000402040,D1443L00044SeroquelXRRuby,Z450,,ZZ29,D1443L00044,AT
    EU,6067AT,AT10,000000402041,NIS-GEU-DUM-2008/1,Z450,,ZZ29,NIS-GEU-DUM-2008/1,AT
    EU,6067AT,AT10,000000402042,SonstigeAktivitätenLCM,Z450,,ZZ29,.,AT
    EU,6067AT,AT10,000000402134,D1680L00002Saxagliptin,Z450,,ZZ29,D1680L00002,AT
    EU,6067AT,AT10,000000402199,SeroquelWaveNIS,Z450,,ZZ29,NIS-NEU-DUM-2009/1,AT
    EU,6067AT,AT10,000000402313,SeroquelExtra(D1443L00082),Z450,,ZZ29,D1443L00082,AT
    EU,6067AT,AT10,000000402517,AtlanticD5130L00006(AZD6140),Z450,,ZZ29,D5130L00006,AT
    EU,6067AT,AT10,000000554494,ArimidexSt.Gallen(13+2),Z142,,ZZ09,,AT
    EU,6067AT,AT10,000000554495,ArimidexASCO(5delegates),Z142,,ZZ09,,AT
    EU,6067AT,AT10,000000554496,ArimidexSanAntonio6delegates,Z142,,ZZ09,,AT
    EU,6067AT,AT10,000000554497,ArimidexBreastCancerSummit(13+2),Z130,,ZZ09,,AT
    EU,6067AT,AT10,000000554498,ArimidexEIH(15delegates),Z130,,ZZ09,,AT
    EU,6067AT,AT10,000000554499,ArimidexNIFA(200delegates),Z135,,ZZ09,,AT
    EU,6067AT,AT10,000000554500,ArimidexNIFAworkshops(8x25),Z135,,ZZ09,,AT
    EU,6067AT,AT10,000000554501,ArimidexPraktischeGyn.Fortbildung,Z147,,ZZ09,,AT
    EU,6067AT,AT10,000000554502,ArimidexAGO,Z147,,ZZ09,,AT
    EU,6067AT,AT10,000000554503,ArimidexHämato/OnkologieKongress,Z147,,ZZ09,,AT
    EU,6067AT,AT10,000000554504,ARIMIDEXGYNäKOLOGENKONGRESS,Z147,,ZZ09,,AT
    EU,6067AT,AT10,000000554505,ArimidexChirurgenkongress,Z147,,ZZ09,,AT
    EXPECTED RESULTS:
    AFFIRM_CODE COMPANY_CODE INTERNAL_ORDER_CODE INTERNAL_ORDER_DESC ENIGMA_ACTIVITY             SUB_ACTIVITY_CODE IN_AFF_IND ORDER_TYPE EXTERNAL_ORDER COUNTRY        
    EU          6067AT       AT10                 000000402004       NEXIUMGERDMANAGEMENTPROJECT     Z435           NULL        ZZ29       NIS-GOLD        AT             
    EU          6068AT       AT11                 000000402005       NEXIUMGERDMANAGEMENTPROJECT     Z435           NULL        ZZ29       NIS-GOLD        AT             

    Sorry, my bad. Without database at hand, I'll try 'baby steps' (borrowed from Frank) so you don't confuse it with errors that I might add (happens far too often already, but at least you won't "swallow" as forum members think is one of the main goals of this fighter - help her learn - providing not only the proverbial fish.)
    Search the Forum - your problem is one of its best sellers. Watching {message identifier: = 10694602} ("split string into" was the key word used in research) you can try something as

    select table_row,
           level clob_row,
           regexp_substr(char_data,'[^' || chr(13) || chr(10) || ']+',1,level) the_line
      from (select to_char(queue_seqnum)||':'||to_char(line_seqnum) table_row,
                   char_data
              from order_details
           )
     connect by regexp_substr(char_data,'[^' || chr(13) || chr(10) || ']+',1,level) is not null
            and prior char_data = char_data
            and prior table_row = table_row
            and prior sys_guid() is not null
    

    to get all the s the_lineall CLOB and after that the use of the example even to get your columns of each the_line.

    Concerning

    Etbin

    Edited by: Etbin on 3.2.2013 09:01

    .. .but I m connected to do things according to the instructions, I can't do something.

    Used to happen to me too and I did as told to the but only after explaining any disadvantages, I was aware of in time. The last sentence is usually: "O.K. now be just and Don't come back with that kind of thing when it turns out that this isn't the right thing."
    rp0428 post - something to remember.

  • need help for a conditional query

    guys this is just. as an extension of this post that Frank was helping me. IM reposting because my needs change slightly and im having a hell of a time trying to change the query.
    Here are the previous post.
    need help with query can find data back please help.
    CREATE TABLE "FGL"
      (
        "FGL_GRNT_CODE" VARCHAR2(60),
        "FGL_FUND_CODE" VARCHAR2(60),
        "FGL_ACCT_CODE" VARCHAR2(60),
        "FGL_ORGN_CODE" VARCHAR2(60),
        "FGL_PROG_CODE" VARCHAR2(60),
        "FGL_GRNT_YEAR" VARCHAR2(60),
        "FGL_PERIOD"    VARCHAR2(60),
        "FGL_BUDGET"    VARCHAR2(60)
      )
    data
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','00','400');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','100');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','0');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','1','400');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7200','4730','02','10','1','400');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7600','4730','02','10','1','400');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','14','100');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','2','100');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','11','2','600');
     
     
    I need to find the year of greater subsidy for the granting by a period setting.
    Once I found the great year, I need to check the value of the period 14 this grant for the previous year and add it to the amount of the budget for this grant. However if there is an entry in the biggest year for period 00 so I need to ignore the period 14 of the previous year and the current calculation period + (current period - more great year 00)

    hope that makes sense, so in other words, with the new data above. If I asking me a second period of the grant year 11. I'd end up with $800

    because the greatest year is 11 it contains one point 0 with $ 400, so my total should be
    amount of period $2,600
    period $0 400 - period $2 600 = $200

    600 + 200 = $800

    If I have question period 1 grant 360055 I'd end up just with 800 grnt year 10.

    I tried to edit this query you have provided me with no luck. I tried for several embarrassed day but I'm saying I can just do what im trying to do.
    can you please help me.


    Here's the query provided by frank kulash who graciously put it together for me.
    WITH     got_greatest_year     AS
    (
         SELECT     fgl.*     -- or whatever columns are needed
         ,     MAX ( CASE 
                     WHEN  fgl_period = :given_period 
                     THEN  fgl_grnt_year
                    END
                  ) OVER ()     AS greatest_year
         FROM     fgl
    )
    SELECT     SUM (fgl_budget)     AS total_budget     -- or SELECT *
    FROM     got_greatest_year
    WHERE     (     fgl_grnt_year     = greatest_year
         AND     fgl_period     = :given_period
         )
    OR     (     fgl_grnt_year     = greatest_year - 1
         AND     fgl_period     = 14
         )
    ;
    Miguel

    Hi, Miguel.

    You are waying that when larger year who has: given_period also a period = '00' (or '0', or whatever it is you want to use), then you want to double the budget of the given_period (subtract the '00' budget and do not count '14' year pevious)? If so, add another condition to the CASE statement that decides what you've summarized:

    WITH     got_greatest_year     AS
    (
         SELECT       TO_NUMBER (fgl_grnt_year)     AS grnt_year
         ,       fgl_period
         ,       TO_NUMBER (fgl_budget)     AS budget
         ,       MAX ( CASE
                       WHEN  fgl_period = :given_period
                       THEN  TO_NUMBER (fgl_grnt_year)
                      END
                    ) OVER ()     AS greatest_year
         FROM       fgl
    )
    ,     got_cnt_00     AS
    (
         SELECT     grnt_year
         ,     fgl_period
         ,     budget
         ,     greatest_year
         ,     COUNT ( CASE
                       WHEN  grnt_year     = greatest_year
                       AND       fgl_period     = '00'
                       THEN  1
                         END
                    ) OVER ()          AS cnt_00
         FROM    got_greatest_year
    )
    SELECT       SUM ( CASE
                        WHEN  grnt_year     = greatest_year                    -- New
                  AND       fgl_period     = :given_period                    -- New
                  AND       cnt_00     > 0            THEN  budget * 2     -- New
                        WHEN  grnt_year     = greatest_year
                  AND       fgl_period     = :given_period       THEN  budget
                        WHEN  grnt_year     = greatest_year
                  AND       fgl_period     = '00'            THEN -budget
                        WHEN  grnt_year     = greatest_year - 1
                  AND       fgl_period     = '14'
                  AND       cnt_00     = 0            THEN  budget
                    END
               )          AS total_budget
    FROM       got_cnt_00
    ;
    

    You will notice it is the same as the previous query, I posted, with the exception of 3 lines marked 'new '.

  • I need help for query AVG

    I need help with a simple query in an ORACLE database. I tried a lot of things that I found on the internet, but none of them worked for me.

    The following query retrieves four lines:

    SELECT sampled_date AS VALUE1, VALUE2 AS result, 0 as value3

    Of asw_lab

    WHERE template_result = 'A' AND analysis = 'B' AND ROWNUM < 5

    ORDER BY sampled_date DESC;

    I would like to calculate a moving average of the last four values with the date of the sample of the last line.

    For example, I have this result for the query above:

    Value1 value2 value3

    01/04/14-16:00 1 0

    01/04/14 15:00 2 0

    01/04/14 14:00 3 0

    01/04/14 13:00 4 0

    I want to extract the below my average/query calculation result:

    Value1 value2 value3

    01/04/14-16:00 2.5 0

    Can you help me create a request to that effect?

    Thank you

    Maybe it's

    Select max (VALUE1) VALUE1, VALUE2 avg (VALUE2), avg (VALUE3) value3

    Of

    (

    SELECT sampled_date AS VALUE1, VALUE2 AS result, 0 as value3

    Of asw_lab

    WHERE template_result = 'A' AND analysis = 'B' AND ROWNUM<>

    )

  • need help for this query

    Hi gurus

    need help with this query,

    I want to display the records in the table emp
    SQL> Select Deptno,sal,sal/SUMSAL Percent,rn
      2  From  ( Select emp.*,Sum(Sal) Over() "SUMSAL",Row_number() Over(Order by sal Desc) rn
      3   From emp
      4        )
      5  /
    
          EMPNO     DEPTNO        SAL    PERCENT         RN
    --------- ---------- ---------- ---------- ----------
         7839         10       5000 .172265289          1
         7902         20       3000 .103359173          2
         7788         20       3000 .103359173          3
         7566         20       2975 .102497847          4
         7698         30       2850 .098191214          5
         7782         10       2450 .084409991          6
         7499         30       1600 .055124892          7
         7844         30       1500 .051679587          8
         7934         10       1300 .044788975          9
         7521         30       1250 .043066322         10
         7654         30       1250 .043066322         11
         7876         20       1100 .037898363         12
         7900         30        950 .032730405         13
         7369         20        800 .027562446         14
    
    14 rows selected.
                   
     
    I want just the records
          EMPNO     DEPTNO        SAL    PERCENT         RN
    ---------- ---------- ---------- ---------- ----------
          7839         10       5000 .172265289          1
          7902         20       3000 .103359173          2
          7788         20       3000 .103359173          3
          7566         20       2975 .102497847          4
          7698         30       2850 .098191214          5
    with sum (Percent) of remaing records.....
        Others                          .420327304  
    Thank you

    Published by: SeenuGuddu on February 27, 2011 03:39
    with a as
    (
    Select
    Empno, Deptno ,sal, sal/SUMSAL Percent,
    case when rn<=5 then rn else null end rnm
    From  (Select emp.*, Sum(Sal) Over() "SUMSAL",
    Row_number() Over(Order by sal Desc) rn
    From emp)
    )
    select
    case when max(rnm) is not null then to_char(max(empno)) else 'Others:' end empno,
    case when max(rnm) is not null then max(deptno) else null end deptno,
    case when max(rnm) is not null then max(sal) else null end sal,
    to_char(sum(percent), '90.99') percent,
    max(rnm) rn
    from a
    group by rnm order by rnm
    
    EMPNO                                    DEPTNO                 SAL                    PERCENT RN
    ---------------------------------------- ---------------------- ---------------------- ------- ----------------------
    7839                                     10                     5000                     0.17  1
    7902                                     20                     3000                     0.10  2
    7788                                     20                     3000                     0.10  3
    7566                                     20                     2975                     0.10  4
    7698                                     30                     2850                     0.10  5
    Others:                                                                                  0.42                         
    
    6 rows selected
    
  • Need help for slideshow

    I edited a video, which is basically still images. However, I have chosen images in all sizes, thinking, wrongly, that what eventually once uploaded to YouTube with the same footprint. Is there a step process that can help me achieve this goal?

    I would like that all the scenes in my video to appear, once uploaded to YouTube, to be of the same size. Some images are larger than others, but those who are smaller have a black border surrounding them. I admit that I need a lot of help with that. Thank you.

    Post edited by: Kevin Monahan

    Reason: your title is too long

    So you're ready for the next show!

    Or, maybe just happy you did it through this one and very well if you have never to do it again.

    Are you able to use the ' ~ ' key to the entire window and "control ~" for full screen?

    Another feature may be useful for the next is "automate to sequence...". ».  If your source of the layer film is ready just to the right, it can be a huge time saver.  Even if you compare it to what it's like 'Text to Table' action in Microsoft Word.  If the text is formatted just right, you end up with a large table to the research.  If a single line of text is disabled, you can spend a lot of time tweaking things (and to test your patience).

  • Bitmap Vs domain of index for large tables

    I have a DB warehouse which consists of very large tables.

    I have two questions:

    1 can I use Bitmap or field type index?

    2. use a different tablespace for storing the indices? This would improve performance?

    Please give me advice to improve the performance of queries for these large tables (more than 300 M record).

    Concerning

    When to use bitmap indexes

    ------------------------------

    -The column has a low cardinality: little separate value

    -Bitmap indexes are particularly useful for complex with ad-hoc queries

    long WHERE clauses or applications of aggregation (containing SUM, COUNT, or other

    aggregate functions)

    -The table contains the number of lines (1,000,000 lines with 10,000 distinct values)

    may be acceptable)

    -There are frequent, possibly ad hoc queries on the table

    -L' environment is focused on the data warehouse (System DSS). Bitmap indexes are

    not ideal for due processing (OLTP) environments transactional online

    their locking behavior. It is not possible to lock a single bitmap.

    The smallest amount of a bitmap that can be locked is a bitmap segment, which

    can be a block of data up to half size. Changing the value of a row results in

    a bitmap segment becomes locked, blocking to force change on a number of lines.

    This is a serious drawback when there are several UPDATE, INSERT or DELETE

    statements made by users. It is not a problem when loading data or

    updated to the stock in bulk, as in data warehouse systems.

    -Bitmap join indexes are a new method of 9.0 by which joins can be avoided in

    pre-creation index bitmap on the join criteria.

    The BJI is an effective way of space reduction in the volume of selected data.

    The data resulting from the join operation and restrictions are

    kept permanently in a BJI. The join condition is a join, equi-internal between the

    column/columns in primary key of the dimension and the foreign key tables

    column or columns in the fact table.

    When to use domain indexes

    ---------------------------------------

    https://docs.Oracle.com/CD/E11882_01/AppDev.112/e41502/adfns_indexes.htm#ADFNS00504

  • Tecra R840 - need help for installing the SSD

    Hello

    Sorry, again, but I really need help with that?
    My new ssd (arriving in a few days) is a Plextor M5P which is 7 mm thick! My Tecra R840-16J have a thickness 9.5 mm HDD and what I've seen is no caddy!
    I would be grateful all the tricks for installing the ssd drive in my Tecra!

    Thanks for your time,

    Paulo

    Hello Paulo

    As far as I know that some models are available with drive HARD and some with SSD these models with SSD have small SSD support. SSD is fixed by 4 screws in this medium.

    I put t really know how to help you now. Maybe you should contact the nearest Toshiba service provider and ask for help. I think they can check the part number of this door - or maybe order one for you.

Maybe you are looking for

  • Permanently delete the 10.8.5 OS startup sound

    After installing the OS on 10.6.8 10.8.5 I lost my sound supresser of startup.  I tried "sudo nvram SystemAudioVolume = $ 80" code in the terminal without result.  Hate the noise... what to do?

  • Coding + sign in the search by keyword

    I'm trying to figure out how I can use a + sign when you use a keyword search. Let's say I have the installation of google as a search by keyword at google.com Google 2 + 2-> http://www.google.com/search?hl=en & source = hp & biw = & bih = & q = 2 +

  • El Capitan does support multiple iTunes accounts?

    Hello As I was updating my Macbook Air (2011) to El Capitan, I was asked of my Apple ID before even downloading. I suspect that the identifier Apple is baked into the OS now, so I wonder: will I be able to use another Apple ID in iTunes store? I have

  • Customer at the vs Site

    I am looking to buy a Prosecure appliance for a client especially for VPN functionality. To give some background, they currently have 5 sites of connection to a main offfice. I know their number of sites will grow. They will also have a casual user t

  • HDD SAS 300 GB switchable to hot sostitutivo by PE T320 fuori co [DS]

    Buongiorno, avrei need della quotazione by a HDD sostitutivo su UN Poweredge T320 fuori co. He guasto disco e: Parte Qta description G937K 4 SCREW 6-32 X 225, PHILLIPS, FLAT, BLACK HEADF617N HARD DRIVE 1, 300G, SAS6, 15K, 3.5, S - EG, E/CFM833 1 labe