How to make it more efficient

Hi,
I am working on AQ where I am just sending and receiving simple messages. But the performance is very poor. It takes around 35 seconds to send (enqueue) just 100 messages which is not acceptable for our project. Can someone help me how to make it more efficient. I am using JMS for sending and receiving messages.
Thanks,
Sateesh

Bhagath,
Thanks for your help.
Oracle server we are using is 8.1.7. We are using JDBC client that ships with Oracle client (classes12.zip).
Right now we are working on point to point messages.
I am just wondering whether I need to do any tuning on server.
Your help is greately appreciated.
Here I am pasting sample code that I wrote which may help in finding the problem.
Thank you so much once again for your help.
-Sateesh
import java.sql.*;
import javax.jms.*;
import java.io.*;
import java.util.Properties;
import oracle.AQ.*;
import oracle.jms.*;
public class CDRQueueSender {
private final String DB_CONNECTION = "jdbc:oracle:thin:@dev1:1521:dev";
protected final String DB_AQ_ADMIN_NAME = "dev78";
private final String DB_AQ_ADMIN_PASSWORD = "dev78";
/** DB AQ user agent name and password */
private final String DB_AQ_USER_NAME = "dev78";
private final String DB_AQ_USER_PASSWORD = "dev78";
private QueueConnectionFactory queueConnectionFactory = null;
private QueueConnection connection = null;
private QueueSession session = null;
private Queue sendQueue;
private QueueSender qSender;
public CDRQueueSender() {
try {
Properties info = new Properties();
info.put(DB_AQ_USER_NAME, DB_AQ_USER_PASSWORD);
queueConnectionFactory = AQjmsFactory
.getQueueConnectionFactory(DB_CONNECTION, info);
connection = queueConnectionFactory.
createQueueConnection(DB_AQ_USER_NAME,
DB_AQ_USER_PASSWORD);
session = connection.createQueueSession(
true, Session.AUTO_ACKNOWLEDGE);
connection.start();
sendQueue = ((AQjmsSession) session).getQueue (DB_AQ_ADMIN_NAME,"CDR_QUEUE");
qSender = session.createSender(sendQueue);
catch (Exception ex) {
ex.printStackTrace();
public boolean sendCDRMessage(CDRMessage messageData)
throws JMSException, SQLException {
ObjectMessage objectMessage = session.createObjectMessage(messageData);
try {
qSender.send(objectMessage);
session.commit();
catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
return true;
public void close() throws JMSException {
session.close();
connection.close();
public static void main(String[] args) throws SQLException, JMSException {
int count = 0;
CDRQueueSender qSender = new CDRQueueSender();
long startTime = System.currentTimeMillis();
long endTime;
CDRMessage message;
while(count < 100) {
message = new CDRMessage("filename", 20, "This is testing", count);
qSender.sendCDRMessage(message);
count++;
//qSender.sessionCommit();
endTime = System.currentTimeMillis();
System.out.println("time taken to process 100 records is " +
((endTime - startTime)/1000) + " seconds");
qSender.close();

Similar Messages

  • Make Code More Efficient

    I got this code to play some audio clips and it works alright. The only issue is that when I call the play method it lags the rest of my game pretty badly. Is there anything in the play method you guys think could be moved to the constructor to make it more efficient?
    package main;
    import java.io.*;
    import javax.sound.sampled.*;
    public class Sound
         private AudioFormat format;
        private byte[] samples;
        private String name;
         public Sound(String filename)
              name=filename;
              try
                AudioInputStream stream =AudioSystem.getAudioInputStream(new File("sounds/"+filename));
                format = stream.getFormat();
                samples = getSamples(stream);
            }catch (Exception e){System.out.println(e);}
         public byte[] getSamples()
            return samples;
        private byte[] getSamples(AudioInputStream audioStream)
            int length=(int)(audioStream.getFrameLength()*format.getFrameSize());
            byte[] samples = new byte[length];
            DataInputStream is = new DataInputStream(audioStream);
            try
                is.readFully(samples);
            }catch (Exception e){System.out.println(e);}
            return samples;
        public void play()
             InputStream stream =new ByteArrayInputStream(getSamples());
            int bufferSize = format.getFrameSize()*Math.round(format.getSampleRate() / 10);
            byte[] buffer = new byte[bufferSize];
            SourceDataLine line;
            try
                DataLine.Info info=new DataLine.Info(SourceDataLine.class, format);
                line=(SourceDataLine)AudioSystem.getLine(info);
                line.open(format, bufferSize);
            }catch (Exception e){System.out.println(e);return;}
            line.start();
            try
                int numBytesRead = 0;
                while (numBytesRead != -1)
                    numBytesRead =
                        stream.read(buffer, 0, buffer.length);
                    if (numBytesRead != -1)
                       line.write(buffer, 0, numBytesRead);
            }catch (Exception e){System.out.println(e);}
            line.drain();
            line.close();
        public String getName()
             return name;
    }

    I don't know much about the guts of flex, but I assume it's
    based on Java's design etc.
    Storing event.target.selectedItem in an objet should not be
    anymore efficient than calling event.target.selectedItem. The objet
    will simply be a pointer of sorts to event.target.selectedItem. At
    no point in the event.target.selectedItem call are you doing a
    search or something, so storing the result will not result in any
    big savings.
    Now, if you were doing something like
    array.findItem(something) 4 times, then yes, it would be to your
    advantage to store the data.
    Keep in mind that storing event.target.selectedItem in an
    object will probably break bindings....that may or may not be a
    problem. Objet doesn't support binding. There is a subclass of
    Object that does, but I forget which.
    Just a suggestion based on my knowledge of how data is stored
    in an object oriented language...this may not be the case in
    flex.

  • Please Suggest, How to make this view efficient ?

    Hi there,
    Could you please suggest me,how to make the following VIEW (QUERY) efficient regarding performance point of view.
    CREATE OR REPLACE VIEW XXX_TRX_TO_NUM_V
    (ROW_NUM, ORIG_TRX_NUM, TRX_NUMBER, TRX_DATE, PURCHASE_ORDER,INTERFACE_HEADER_ATTRIBUTE6, INTERFACE_HEADER_ATTRIBUTE1, INTERFACE_HEADER_ATTRIBUTE5, BILL_TO_CONTACT_ID, REMIT_TO_ADDRESS_ID, BILL_TO_CUSTOMER_ID, BILL_TO_SITE_USE_ID, ORG_ID)
    AS
    Select rownum row_num,trx_number orig_trx_num,to_number(a.trx_number) trx_number,a.trx_date,a.purchase_order,a.interface_header_attribute1
    ,a.interface_header_attribute6,a.interface_header_attribute5,a.bill_to_contact_id
    ,a.remit_to_address_id,a.bill_to_customer_id,a.bill_to_site_use_id,a.org_id
    from ra_customer_trx_all a
    where a.trx_number is not null
    and a.trx_number not in
    (select trx_number
    from
    (select rownum,/*+ ALL_ROWS ,16 */ r.trx_number,ltrim(rtrim(translate(/*+ ALL_ROWS ,16 */ r.TRX_number,'0123456789',' '), ' ' ), ' ' ) tx
    from ra_customer_trx_all r)
    where tx is not null)
    order by trx_number
    Thanks in Advance !
    Shahzad

    I think you have the hints in the wrong place - as far as I was aware, the hint had to come straight after the SELECT/UPDATE/INSERT/DELETE key word - but I could be wrong as I've never really tried it elsewhere. Also, unless the optimiser mode for your database is set to FIRST_ROWS or RULE (god help you!:), ALL_ROWS is the default behaviour.
    Basically what you are trying to say is bring me back all ra_customer_trx_all rows that have purely numeric trx_numbers right?
    Why, if you need to be able to represent trx_number as a number, do you have non-numeric data in there???? That's a bit dodgy isn't it?
    Anyway, what about:
    CREATE TABLE dt_test_num (id varchar2(10))
    insert
    into
         dt_test_num
    select
         chr(47 + rownum)
    from
         all_tables
    where
         rownum <= 20
    select
         to_number(id),
         id
    from
         dt_test_num
    where
         translate(id,'0123456789',' ') IS NULL
    update
         dt_test_num
    set
         id=id||chr(67-rownum)
    select
    FROM
         dt_test_num
    select
         to_number(id),
         id
    from
         dt_test_num
    where
         translate(id,'0123456789',' ') IS NULL
    /Also, you are selecting rownum and aliasing it. Why? rownum will be assigned before the sort.
    HTH
    David
    Message was edited by:
    david_tyler
    Hello
    Slight correction to the where clause. Art first I thought you didn't need the trim on there, but that was just down to the number sequence in translate...
    SQL> select nvl(translate('1A','1234567890',''),'NULL') from dual
      2  /
    NVL(
    NULL
    SQL> select nvl(translate('1A','1234567890',' '),'NULL') from dual
      2  /
    NV
    A
    SQL> select nvl(translate('1','1234567890',' '),'NULL') from dual
      2  /
    N
    SQL> select nvl(translate('2','1234567890',' '),'NULL') from dual
      2  /
    NVL(
    NULL
    SQL> select nvl(translate('2','0123456789',' '),'NULL') from dual
      2  /
    NVL(
    NULL
    SQL> select nvl(translate('1','0123456789',' '),'NULL') from dual
      2  /
    NVL(
    NULL
    SQL> select nvl(translate('0','0123456789',' '),'NULL') from dual
      2  /
    N
    SQL> select nvl(TRIM(translate('0','0123456789',' ')),'NULL') from dual
      2  /
    NVL(
    NULL
    SQL> select nvl(TRIM(translate('1','0123456789',' ')),'NULL') from dual
      2  /
    NVL(
    NULLTranslate still confuses me :-(

  • How to write queries more efficiently? Please Help a sinking guy

    Hello Query Guru's,
      I am having issue writing the SQL statements efficiently, please help/guide me to learn how to write SQL’s more efficiently and logically. At my work I am being a fun every day by my team when comes the coding please guide me to become an efficient query writer. I am starving and ready to do hard work but need to know the correct path.
    Thanks in Advance.

    You could pick up examples from introductory books on Oracle.
    For example the Certification Guides for the Oracle SQL Fundamentals Guide  (1Z0-051 http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=5001&get_params=p_exam_id:1Z0-051&p_org_id=&lang=    ) .  Search bookstores / amazon.com  for books for 1Z0-051
    You could also look at Jason Price's book Oracle Database 11g SQL  :  http://www.amazon.com/Oracle-Database-11g-SQL-Press/dp/0071498508/ref=sr_1_1?ie=UTF8&qid=1372742972&sr=8-1&keywords=Jason+Price
    Hemant K Chitale

  • Building Query in Pre-Query. How to make it more Memory Efficient

    Hello all,
    I have a form with 2 Data Blocks.
    First Block is used for giving query Parameters and second one returns the results based on a View.
    I build the Select Clause in the pre-query based on the Parameters. So every time I have a Different Query.
    Could that create problem in the Database Server due to parsing queries again and again?
    Would using a Different approach (i.e. ref Cursors) be more memory Efficient?
    Thanks

    The pre-query is quite Large so I am pasting only a part of the Code (the rest of it Is Identical).
    In the selects v is the alias of the View of the Second Data Block.
    The :qf_ bind variables are fields of the First block where I give the Parameters.
                   IF :QF_IS_DISPLAYED=1 THEN
                   L_WHERE := L_WHERE || ' AND V.IS_DISPLAYED =''1''';
                   END IF;
                   IF :qf_colour IS NOT NULL THEN
                   L_WHERE := L_WHERE || ' AND item_colour=''' ||:qf_colour ||'''';
                   END IF;
         IF :qf_product_item_colour IS NOT NULL THEN
                   L_WHERE := L_WHERE || ' AND product_item_colour=''' ||:qf_product_item_colour ||'''';
         END IF;
         IF :qf_product_length IS NOT NULL THEN
                   L_WHERE := L_WHERE || ' AND product_length=''' ||:qf_product_length ||'''';
         END IF;
                   IF :qf_apf_batch_id IS NOT NULL THEN
                   L_WHERE := L_WHERE || ' AND apf_batch_id=' ||:qf_apf_batch_id;
                   END IF;
                        if :qf_prod_resource is not null then
                        L_WHERE := L_WHERE ||' AND v.resources = ''' ||:qf_prod_resource ||'''';
                        end if;
                        if :qf_customer_number is not null then
                        L_WHERE := L_WHERE || ' AND FACTORY_ORDER_ID IN (SELECT FA.FACTORY_ORDER_ID
                                                                                                                                                     FROM OE_ORDER_HEADERS_ALL OH,
                                                                                                                                                                    RA_CUSTOMERS RA,
                                                                                                                                                                    XXSC_DEMAND_LINES DL,
                                                                                                                                                                    XXSC_FACTORY_ORDERS FA
                                                                                                                                                     WHERE      OH.SOLD_TO_ORG_ID = RA.CUSTOMER_ID
                                                                                                                                                     AND      DL.SOURCE_HEADER_ID = OH.HEADER_ID
                                                                                                                                                     AND          DL.FACTORY_ORDER_ID = FA.FACTORY_ORDER_ID
                                                                                                                                                     AND               RA.CUSTOMER_NUMBER = ''' ||:qf_customer_number ||''')';
                        end if;

  • How to make this program efficient?

    Hola Amigos, I'm trying to explore all the possibilities about comparing two arrays. I know the following code is O(n^2) is it possible to make it O(n) without recursion or is recursion the only way. I ask this because we are being taught recursion and I don't quite understand it. I don't see the relation from recursion taught in Discrete Math with the one taught in programming, Thanks.....
    public class twoArrays
         public static int max = -1;
         public static int findMax(int oneArray [], int twoArray [])
              for (int i = 0 ; i < oneArray.length ; i ++)
                   for ( int j = 0; j < twoArray.length ; j++)
                        max = Math.max(max,Math.max(oneArray,twoArray[j]));     
              return max;
         public static void main (String [] args)
              int[] a = {1,5,8,30,80,99,140,160,170,180,190,200};
              int[] b = {2,4,7,45,60,85,98,150,155,175,195,205};
              findMax(a,b);
              System.out.println("The highest value is: " + max);
    Ah, one more thing the word "static" how can I call a method from a non-static context. Very confussing for me, thanks again.

    To call a non-static method you can use an instance of the class.
    Example:
    public class twoArrays {
    public static int max = -1;
    public int findMax(int oneArray [], int twoArray []){//non-static
         for (int i = 0 ; i < oneArray.length ; i ++){
         for ( int j = 0; j < twoArray.length ; j++)                    max = Math.max(max,Math.max(oneArray,twoArray[j]));          }
         return max;
    public static void main (String [] args)     {          
    int[] a = {1,5,8,30,80,99,140,160,170,180,190,200};
    int[] b = {2,4,7,45,60,85,98,150,155,175,195,205};
    ( new twoArrays() ).findMax(a,b);/*through an anonymous instance of the class, you can call findMax method */
    System.out.println("The highest value is: " + max);          
    Hope it will help you.
    p.d.: max is initialized -1 cause then into findmax, you asure that max will never again has value -1 (the two arrays contains numbers > -1 )so max at least will be higher than -1.
    Sorry for my english.
    Saludos

  • I can't read Or write I have been using the iPad With the accessibility icon Is there a video help them teach me how to use it more efficiently

    I cannot read or write I have been using the iPad With the accessibility icon  Is there a video to help teach me To learn how to use this accessibility more efficiently

    It sounds like you may have multiple problems, but none of them are likely to be caused by malware.
    First, the internet-related issues may be related to adware or a network compromise. I tend to lean more towards the latter, based on your description of the problem. See:
    http://www.adwaremedic.com/kb/baddns.php
    http://www.adwaremedic.com/kb/hackedrouter.php
    If investigation shows that this is not a network-specific issue, then it's probably adware. See my Adware Removal Guide for help finding and removing it. Note that you mention AdBlock as if it should have prevented this, but it's important to understand that ad blockers do not protect you against adware in any way. Neither would any kind of anti-virus software, which often doesn't detect adware.
    As for the other issues, it sounds like you've got some serious corruption. I would be inclined to say it sounds like a failing drive, except it sounds like you just got it replaced. How did you get all your files back after the new drive was installed?
    (Fair disclosure: I may receive compensation from links to my sites, TheSafeMac.com and AdwareMedic.com, in the form of buttons allowing for donations. Donations are not required to use my site or software.)

  • My mac is slow. How can it run more efficiently?

    I find that my 2 year old Macbook Pro is super slow and just started to run slow about 4 months ago. It takes a long time to load and execute programs. Is there anything that I can do at home to allow the computer to run faster?

    First, back up all data immediately, as your boot drive might be failing.
    Take these steps when you notice the problem.
    Step 1
    Launch the Activity Monitor application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Activity Monitor in the icon grid.
    Select the CPU tab of the Activity Monitor window.
    Select All Processes from the menu in the toolbar, if not already selected.
    Click the heading of the % CPU column in the process table to sort the entries by CPU usage. You may have to click it twice to get the highest value at the top. What is it, and what is the process? Also post the values for % User, % System, and % Idle at the bottom of the window.
    Select the System Memory tab. What values are shown in the bottom part of the window for Page outs and Swap used?
    Next, select the Disk Activity tab. Post the approximate values shown for Reads in/sec and Writes out/sec (not Reads in and Writes out.)
    Step 2
    You must be logged in as an administrator to carry out this step.
    Launch the Console application in the same way as above. Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left.
    Post the 50 or so most recent messages in the log — the text, please, not a screenshot.
    When posting a log extract, be selective. Don't post more than is requested.
    Please do not indiscriminately dump thousands of lines from the log into a message.
    Important: Some personal information, such as your name, may appear in the log. Edit it out before posting.

  • Song Shuffle question, how to make it more random?

    80GB Classic with latest (I think) SW downloads.
    Whether using playlists or listening to the complete song listing, the shuffle does not appear to be giving me a true shuffle. I have maybe 3500 songs, some are played the next day, some haven't been played in two years. Playlists exhibit the same tendency, some songs with over 30 plays, some with less than five.
    I tried setting up an exclusion in the smartlist where I told it to not put the song on the smart list if it had been played in the previous 20 days. That worked sort of OK, but I had to dock the iPOD every day to keep that working.
    Is there a better way to get more random music selection? I have the randomness setting at max (no chance of playing same artist twice). Or at least I thought I did, but I cannot find that setting now.

    Make sure you have *Live Updating* ticked in the smart playlist.
    On the iPod, start playing a new playlist, then go back to the original playlist and it should be updated (dropping of the recently played songs).
    Also, when starting a playlist, go to Music -> Playlists, scroll to the name of the playlist you want and press Play, (not Select).

  • Suggestion for how to make text more legible with line in background?

    I want to create a dashed line that connects a bunch of text located inside a text box. However, the dashed line seems to conflict a bit with the text visually, making it difficult to read. I sent the line to the back and put small white rectangles behind the text to block the line, though I am going to have lots of these, and it is a pain. Anyone have any other suggestions?
    Thanks

    The white stroke is more a movie sub title thing and like in the movies does not always work.
    Try this and see if you like it
    select the text with a selection tool
    add a new fill of white and drag the fill below the characters in th appearance panel
    the highlight the new fill in the appearance panel
    then go to Effect>Convert to Shape>Rectangle
    give it  2pts extra relative space
    below with the new fill converted not visible
    withe the new fill converted to a rectangle visible
    The problem with this method and the extra stroke method is that they are not transparent and if you place an object below them you will see the stroke or
    fill
    You can vary the gaps and fills until you get the right combination but that might be very difficult unless you simply vary the placement of the  text.

  • My Windows 7 Pro went completely doo lally - I completely reinstalled Windows 7 pro but forgot to save anything from Itunes - I know what the names of the 2 playlists I had but not sure how to make 2 more playlists and install mainly audiobooks back

    My Windows 7 Pro went completely doo-Lally - I reinstalled the Windows 7 but I forgot to do anyting with Itune.
    What I would like to know is, how do I get 2 playlists back into Itunes and then move audiobooks back into them.
    As I said earlier, I have no backups from Itunes at all - I think I might learn a lesson from this 
    Regards
    Bill

    Many thanks.
    With those symptoms, I'd try the following document:
    Apple software on Windows: May see performance issues and blank iTunes Store
    (If there's a SpeedBit LSP showing up in Autoruns, it's usually best to just uninstall your SpeedBit Video Accelerator.)

  • Make queries more efficient

    -- I need the week numbers and beginning of week for the current year along with its corresponding date last year
    -- This code works but I have seen an example using LEVELS which was a lot easier to understand ( I can't find it)
    With LastYear as
      select year,
           week_nbr,
           next_day(  to_date( '04-jan-' || year, 'dd-mon-yyyy' ) + (week_nbr-2)*7, 'mon' )  as week_date
    from ( 
           select '2008' year,
                   rownum week_nbr
            from all_objects where rownum <= 53 )
    , CurrYear as
    select year,
           week_nbr,
           next_day(  to_date( '04-jan-' || year, 'dd-mon-yyyy' ) + (week_nbr-2)*7, 'mon' )  as week_date
    from ( 
           select '2009' year,
                   rownum week_nbr
            from all_objects where rownum <= 53 )
    --=====  Dates user by report
    , Report_Dates as
    select   ly.week_nbr  as  week_nbr
           , ly.week_date as  last_year_week_date
           , cy.week_date as  curr_year_week_date    
    from   lastYear ly
    inner join  CurrYear cy on cy.week_nbr = ly.week_nbr
    where cy.week_date < to_date('23-Nov-09', 'dd-Mon-yy') + 6
    select * from report_Dates;I also need to get current week sales as well as YTD sales
    I do so by selecting all data from beginning of year to the end of reporting week (in example data, I use week 48, begin of week Nov-23-2009)
    Then I group on week nbr where any date less than beginning of reporting week = 0 , otherwise groups on the week_nbr
    This gets messy when I have to do a complex calculation with the year-to-date amount because I have to add the partial YTD + WTD to get true
    YTD amount. How can I avoid having to do this?
    begin
      execute immediate 'drop table my_hotdog_sales';
      exception when others then null;
    end;
      CREATE TABLE MY_HOTDOG_SALES
       (     "STOREID" NUMBER NOT NULL ENABLE,
         "BUSI_DATE" DATE,
         "SALES" NUMBER,
         "GUESTS" NUMBER
    delete from my_hotdog_sales;
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('29-DEC-08','DD-MON-RR'),1595.62,370);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('05-JAN-09','DD-MON-RR'),1732.74,406);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('12-JAN-09','DD-MON-RR'),1708.01,406);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('19-JAN-09','DD-MON-RR'),1849.55,433);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('26-JAN-09','DD-MON-RR'),1641.34,378);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('02-FEB-09','DD-MON-RR'),2037.7,459);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('09-FEB-09','DD-MON-RR'),2209.37,504);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('16-FEB-09','DD-MON-RR'),1899.38,407);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('23-FEB-09','DD-MON-RR'),2072.33,446);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('02-MAR-09','DD-MON-RR'),1990.67,432);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('09-MAR-09','DD-MON-RR'),1940.02,430);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('16-MAR-09','DD-MON-RR'),1987.58,445);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('23-MAR-09','DD-MON-RR'),1873.04,428);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('30-MAR-09','DD-MON-RR'),2102.02,457);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('06-APR-09','DD-MON-RR'),1877.87,415);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('13-APR-09','DD-MON-RR'),1861.76,415);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('20-APR-09','DD-MON-RR'),1962.48,440);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('27-APR-09','DD-MON-RR'),2032.6,447);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('04-MAY-09','DD-MON-RR'),2213.7,481);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('11-MAY-09','DD-MON-RR'),2017.93,446);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('18-MAY-09','DD-MON-RR'),2025.67,452);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('25-MAY-09','DD-MON-RR'),1904.92,428);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('01-JUN-09','DD-MON-RR'),2219.46,471);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('08-JUN-09','DD-MON-RR'),2167.82,478);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('15-JUN-09','DD-MON-RR'),2056.53,468);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('22-JUN-09','DD-MON-RR'),2028.29,453);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('29-JUN-09','DD-MON-RR'),1870.82,392);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('06-JUL-09','DD-MON-RR'),2161.31,463);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('13-JUL-09','DD-MON-RR'),1929.36,419);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('20-JUL-09','DD-MON-RR'),1960.85,425);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('27-JUL-09','DD-MON-RR'),1722.19,399);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('03-AUG-09','DD-MON-RR'),1904.76,425);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('10-AUG-09','DD-MON-RR'),2108.2,473);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('17-AUG-09','DD-MON-RR'),1803.95,413);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('24-AUG-09','DD-MON-RR'),1889.63,431);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('31-AUG-09','DD-MON-RR'),1937.33,415);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('07-SEP-09','DD-MON-RR'),1749.52,395);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('14-SEP-09','DD-MON-RR'),1964.21,437);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('21-SEP-09','DD-MON-RR'),1954.87,436);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('28-SEP-09','DD-MON-RR'),2110.1,474);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('05-OCT-09','DD-MON-RR'),1879.43,409);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('12-OCT-09','DD-MON-RR'),1878.7,393);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('19-OCT-09','DD-MON-RR'),2101.44,473);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('26-OCT-09','DD-MON-RR'),1822.08,405);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('02-NOV-09','DD-MON-RR'),2167.69,467);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('09-NOV-09','DD-MON-RR'),1938.87,420);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('16-NOV-09','DD-MON-RR'),2069.88,460);
    Insert into MY_HOTDOG_SALES (STOREID,BUSI_DATE,SALES,GUESTS) values (243,to_date('23-NOV-09','DD-MON-RR'),1545.23,328);
    With LastYear as
      select year,
           week_nbr,
           next_day(  to_date( '04-jan-' || year, 'dd-mon-yyyy' ) + (week_nbr-2)*7, 'mon' )  as week_date
    from ( 
           select '2008' year,
                   rownum week_nbr
            from all_objects where rownum <= 53 )
    , CurrYear as
    select year,
           week_nbr,
           next_day(  to_date( '04-jan-' || year, 'dd-mon-yyyy' ) + (week_nbr-2)*7, 'mon' )  as week_date
    from ( 
           select '2009' year,
                   rownum week_nbr
            from all_objects where rownum <= 53 )
    --=====  Dates used by report
    , Report_Dates as
    select   ly.week_nbr  as  week_nbr
           , ly.week_date as  last_year_week_date
           , cy.week_date as  curr_year_week_date    
    from   lastYear ly
    inner join  CurrYear cy on cy.week_nbr = ly.week_nbr
    where cy.week_date < to_date('23-Nov-09', 'dd-Mon-yy') + 6
    --====  Curr Year Totals 
    ,curr_year_totals as
    select      storeid
              ,  case when report_dates.curr_year_week_date < trunc(to_date('23-Nov-09', 'dd-Mon-yy'), 'iw') then 0
                      else week_nbr
                end   as    week_nbr 
              , SUM(sales)      as    sales
              , SUM(guests)      as    guests
         from  my_hotdog_sales  csh
         inner join report_dates  on report_dates.curr_year_week_date = trunc(to_date(busi_date, 'dd-Mon-yy'), 'iw')   
         where    trunc(busi_date ,  'iy')   = trunc(to_date('23-Nov-09', 'dd-Mon-yy'), 'iy')
        group by storeid, 
                 case when report_dates.curr_year_week_date < trunc(to_date('23-Nov-09', 'dd-Mon-yy'), 'iw') then 0
                      else week_nbr
                 end
    --====  Curr Year Totals Pivoted to include week and year data
    , pivoted_curr_year_totals as
    select     storeid
              ,  max( decode( week_nbr, 48 ,  sales,   0 ))                as  wtd_sales
              ,  max( decode( week_nbr, 0,    sales  , 0 ))                as  ytd_sales 
              ,  max( decode( week_nbr, 48 ,  guests,   0 ))               as  wtd_guests
              ,  max( decode( week_nbr, 0,    guests  , 0 ))               as  ytd_guests 
    from  curr_year_totals
    group by storeid
    Select 
        storeid
         ,  sum(curr.wtd_sales)                           as curr_wtd_sales
         ,  sum(curr.ytd_sales   +  curr.wtd_sales)       as curr_ytd_sales
         ,  sum(curr.wtd_guests)                          as curr_wtd_guests
         ,  sum( curr.ytd_guests  - curr.wtd_guests)      as wtd_guests_diff   
    from pivoted_curr_year_totals  curr  
    group by storeid
    order by storeid
    ;   Result:
    STOREID                CURR_WTD_SALES         CURR_YTD_SALES         CURR_WTD_GUESTS        WTD_GUESTS_DIFF       
    243                    1545.23                93478.82               328                    20091       

    The driving table is the anchor point of the execution plan i.e. the databse says "to satisfy the query, first of all I must get the row(s) from _this_ table and that data will allow me to get the row(s) from the next table."
    So the driving table ought to be the table which will return the highest percentage of successful hits. This is usually (but always) the smallest table.
    An example: to find all the items sold by salesmen in a given department requires accessing four tables - PRODUCTS, ORDER_ITEMS, ORDERS and EMP. EMP is the natural candidate for driving table because that is the only table that can answer the question "which SALESMEN are assigned to dept 10?" Once you have their emp_nos you can find all the ORDERS that have been closed by those employees, and so on.
    In the RULE-BASED OPTIMIZER the driving table is the one on the right of the FROM clause ie SELECT ... FROM PRODUCTS, ORDER_ITEMS, ORDERS , EMP WHERE...
    From this you see that you need to understand your data in order to write the query properly.
    In the COST-BASED OPTIMIZER the database will assess the statistics to decide which should be the driving table. For this to work you need to have up to date statisitics for all the tables. Otherwise the CBO might decide to drive from the PRODUCTS table and that would have a serious impact on the peformance of your query.
    HTH, APC

  • Full screen mode in flash player - how to make it more fluent ?

    For some reason I'm experiencing a not fluent picture by watching tennis or other sports on ESPN3 Live on Flash Player.
    The thing is, sometimes in one and the same session, watching the same match switching to full screen mode I get a fluent picture and another time it will jerk.
    In the commercial breaks of the matches I sometimes play some games for some minutes. I can understand that can absorb some memory. Then I put my game screens into the dock and sometimes I get a fluent picture then of my match and sometimes not.
    Does it have anything to do with virtual memory ?
    Can I increase something somewhere to get the picture to be fluent ?
    Thanks
    bafomet

    Full screen mode takes more computer resources, better video quality, a faster broadband connection etc.
    It all depends what type of machine you have, if you have a 15" or 17" MacBook Pro, then head to Energy Saver and turn off graphics switching or enable the high performance option, you will need to be on power.
    The 13" and below you can't help it, it's the lousy integrated graphics.
    Mac video card performance
    Next if the game you were playing is send out Internet connections this could be interrupting or interfering with the streaming service, especially if your download speed of your Internet connection is not all that fast or reliable.
    If you have others on your local network, or local interfereance from applicances or stuff that could be affecting your WiFi signal to your computer.
    If you used a alternate DNS service, one with no local server, that also could be a problem.
    Could be your Flash needs to be updated or reinstalled, the caches flushed out.
    My Flash stopped working!
    You could be having other computer issues
    Step by Step to fix your Mac
    You could be having Wifi issues
    WiFi, Internet problems, possible solutions

  • I think I'm gonna die. My old music from my laptop is something I want to transfer to my iPhone 4s but everytime I sync when i take off my wifi it doesnt work so i use the home sharing. How to make it more permanent on my phone?

    How can i save it permanently to my iPhone when everytime I sync i cant access it ? When i use home sharing as soon as the wifi is down it doesnt work ? I need it to be saved to my phone and I can use it on the go ! I need help, its killing me !!!!!!

    This forum is for questions from those managing sites on iTunes U, Apple's service for colleges and universities to post educational material in the iTunes Store. You'll be most likely to get help with this issue if you ask in the iPhone forum.
    Regards.

  • How to make things more compact?

    I have recently upgraded to Windows 10 and made fresh install and when I was at it, I decided to download new Skype as well. But it is unusable for me, the contact list expanded and even when I disable profile pictures (I cannot make them smaller) the contacrts are far away from each other... And the chat bubbles are huge... I like Skype Window small with compact texts but even if I run it in full screen on 1920×1200 monitor I see 90% of empty space and 10% of text... Is there a way to remove all the gaps in chat and contacts without installing old version?

    green-screen = color-key is just one method to 'punch out' the wanted parts of a pic from the unwanted.
    other methods:
    • luma-key: object is in front of a plain black (or white) background ...
    • alpha-key: 'object' is a computer-generated image, rendered with an alpha-key
    • rotoscoping: you mask the the object by hand from the unwanted parts.
    ...and 'fly' is just key-framing the scenery so it looks like the object is hovering over all .........
    very unspecific question, hm?

Maybe you are looking for

  • DVD drive issues and other problems

    Nothing but problems with my mac since day one. This is the reason why I went from PC to Mac to avoid all these problems. Started with DVD drive problems. Took my computer in as they said wound need to replace the drive -and it would take a week....

  • TNEF Issue - Winmail.dat or messages stuck in submission queue

    Hi guys,  I've looked around the forums and have found people that have had submission queue issues when they set TNEF to $null or $false, and have found that the unified answer is to set TNEF to $true. I also see folks having issues with recipients

  • A few questions if I may

    Hi, I really like the software and I was surpised to see some of the feedback from code warriors, what's wrong with a bit of good old drag and drop? We can always tidy the code afterwards. I think it will cut down on design time for those of us bette

  • Display hyperlinks in Preview 6.0

    I use the standard Preview 6.0 that comes with Mountain Lion to view my pdf documents, and these contain many hyperlinks within. In the past versions of Preview, hyperlinks used to be highlighted with a red box round about them, hence clearly visible

  • Creating a new instance ofthe database

    I'm working on Linux and communicate with the Oracle 8 database from my java program. My problem is ... I want to create a new instance of the database so that my diff. programs will communicate with diff. users., Please crack it out.