How to make only one < full analysis >

Hi all
I have the query as below and I see that she has produced 3 < TABLE ACCESS FULL > for each Union, how to operate with single scan? It's simple table 2 columns, no indexes or PK, just for example.
explain plan for
select count(*) from tt where amt between 0 and 100  union all
select       count(*) from tt where amt between 100 and 200  union all
select       count(*) from tt where amt >200  

----------------------------------------------------------------------------                                                                                                                                                                                                                                 
| Id  | Operation           | Name | Rows  | Bytes | Cost (%CPU)| Time     |                                                                                                                                                                                                                                 
----------------------------------------------------------------------------                                                                                                                                                                                                                                 
|   0 | SELECT STATEMENT    |      |     3 |    39 |     9  (67)| 00:00:01 |                                                                                                                                                                                                                                 
|   1 |  UNION-ALL          |      |       |       |            |          |                                                                                                                                                                                                                                 
|   2 |   SORT AGGREGATE    |      |     1 |    13 |            |          |                                                                                                                                                                                                                                 
|*  3 |    TABLE ACCESS FULL| TT   |     2 |    26 |     3   (0)| 00:00:01 |                                                                                                                                                                                                                                 
|   4 |   SORT AGGREGATE    |      |     1 |    13 |            |          |                                                                                                                                                                                                                                 
|*  5 |    TABLE ACCESS FULL| TT   |     3 |    39 |     3   (0)| 00:00:01 |                                                                                                                                                                                                                                 
|   6 |   SORT AGGREGATE    |      |     1 |    13 |            |          |                                                                                                                                                                                                                                 
|*  7 |    TABLE ACCESS FULL| TT   |     3 |    39 |     3   (0)| 00:00:01 |                                                                                                                                                                                                                                 
----------------------------------------------------------------------------                                                                                                                                                                                                                                 
                                                                                                                                                                                                                                                                                                             
Predicate Information (identified by operation id):                                                                                                                                                                                                                                                          
---------------------------------------------------                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                             
   3 - filter("AMT">=0 AND "AMT"<=100)                                                                                                                                                                                                                                                                       
   5 - filter("AMT">=100 AND "AMT"<=200)                                                                                                                                                                                                                                                                     
   7 - filter("AMT">200)                                                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                                             
Note                                                                                                                                                                                                                                                                                                         
-----                                                                                                                                                                                                                                                                                                        
   - dynamic sampling used for this statement                                                                                                                                                                                                                                                                
SQL> explain plan for
  2  select count(*) from emp where sal between 0 and 100  union all
  3  select       count(*) from emp where sal between 100 and 200  union all
  4  select       count(*) from emp where sal > 200
  5  /

Explained.

SQL> @?\rdbms\admin\utlxpls

PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------------------------------------
Plan hash value: 3840822464

------------------------------------------------------------------------------
| Id  | Operation         | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
------------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |          |     3 |    12 |     3  (67)| 00:00:01 |
|   1 |  UNION-ALL        |          |       |       |            |          |
|   2 |   SORT AGGREGATE  |          |     1 |     4 |            |          |
|*  3 |    INDEX FULL SCAN| EMP_IDX3 |     1 |     4 |     1   (0)| 00:00:01 |
|   4 |   SORT AGGREGATE  |          |     1 |     4 |            |          |
|*  5 |    INDEX FULL SCAN| EMP_IDX3 |     1 |     4 |     1   (0)| 00:00:01 |

PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------------------------------------
|   6 |   SORT AGGREGATE  |          |     1 |     4 |            |          |
|*  7 |    INDEX FULL SCAN| EMP_IDX3 |    14 |    56 |     1   (0)| 00:00:01 |
------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   3 - access("SAL">=0 AND "SAL"<=100)
       filter("SAL"<=100 AND "SAL">=0)
   5 - access("SAL">=100 AND "SAL"<=200)
       filter("SAL"<=200 AND "SAL">=100)

PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------------------------------------
   7 - access("SAL">200)
       filter("SAL">200)

24 rows selected.

SQL> explain plan for
  2  with t as (
  3             select  count(case when sal between 0 and 100 then 1 end) cnt1,
  4                     count(case when sal between 100 and 200 then 1 end) cnt2,
  5                     count(case when sal > 200 then 1 end) cnt3
  6               from  emp
  7            )
  8  select cnt1 from t  union all
  9  select cnt2 from t  union all
 10  select cnt3 from t
 11  /

Explained.

SQL> @?\rdbms\admin\utlxpls

PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------------------------------------
Plan hash value: 2586840053

----------------------------------------------------------------------------------------------------------
| Id  | Operation                  | Name                        | Rows  | Bytes | Cost (%CPU)| Time     |
----------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT           |                             |     3 |    39 |     6  (67)| 00:00:01 |
|   1 |  TEMP TABLE TRANSFORMATION |                             |       |       |            |          |
|   2 |   LOAD AS SELECT           |                             |       |       |            |          |
|   3 |    SORT AGGREGATE          |                             |     1 |     4 |            |          |
|   4 |     TABLE ACCESS FULL      | EMP                         |    14 |    56 |     3   (0)| 00:00:01 |
|   5 |   UNION-ALL                |                             |       |       |            |          |

PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------------------------------------
|   6 |    VIEW                    |                             |     1 |    13 |     2   (0)| 00:00:01 |
|   7 |     TABLE ACCESS FULL      | SYS_TEMP_0FD9D662A_D5091620 |     1 |     4 |     2   (0)| 00:00:01 |
|   8 |    VIEW                    |                             |     1 |    13 |     2   (0)| 00:00:01 |
|   9 |     TABLE ACCESS FULL      | SYS_TEMP_0FD9D662A_D5091620 |     1 |     4 |     2   (0)| 00:00:01 |
|  10 |    VIEW                    |                             |     1 |    13 |     2   (0)| 00:00:01 |
|  11 |     TABLE ACCESS FULL      | SYS_TEMP_0FD9D662A_D5091620 |     1 |     4 |     2   (0)| 00:00:01 |
----------------------------------------------------------------------------------------------------------

18 rows selected.

SQL> 

SY.

Tags: Database

Similar Questions

  • How to make only one item indicator cluster in Labview

    Hi friends,

    In a cluster how to only one item as an indicator. For ex: I joined 1 file t want to do only 2 Boolean LED indication & 2 channels as controls. How to do this.

    Thank you best regards &,.

    Harish. G

    A cluster is an indicator or a control.

    However, you can disable some elements of your cluster by right click control, advanced, enable State or with a property node

    I've set up a small example

  • How to make only ONE tab open every time I start Firefox - still, my screen jumps to the new tab page, although I tried to turn it off?

    I recently had internet service for the first time in two years. Over the two years, I took my desktop computer 4 times for a friend and got the updates that were available for AVG, HP, Windows XP, Adobe, Java, Open Office. As soon as I have internet at my house a few weeks ago, I started to update everything. My computer (HP Pavilion, Pentium 4 of 2006 - old, I know) now seems to work very well, but it's very annoying that everytime I open Firefox, I get a new tab page I ask, in addition to my homepage of Mozilla. Even more annoying is that my computer automatically to this page of the new tab. I tried to disable the new tab page by following the instructions given through the Mozilla 'Getting Started' page, rebooted the computer, and nothing has changed. Please advise!

    You are welcome

  • How to show only one date only over a period of two days, which corresponds to 24 hours

    Hello, I have a problem that I hope someone knows how to fix easily without having to create tables in a schema that things are moving very slow with our DBAs unfortunately because they have too much on their plates at the moment...

    Here is an example of output that I wrote a SQL for:

    SUM (COUNTS) DT

    15 Aug 15 00:00:00 254046

    16 AUG 15 00:00:00 113031

    Now, how to display only 16 August 15 & 367 077 COUNTIES? :

    SUM (COUNTS) DT

    16 Aug 15 00:00:00 367 077

    If the foregoing loses its formatting, I've included a screenshot below of the output currently I want:

    sample.jpg

    The reason is that one of the conditions was for a period of 24 hours, it is defined as 07:00 to 06:59:59 am the next day... of advice/ideas would be greatly appreciated!  I am using Oracle 10 g if that makes a difference.

    I guess that DT Horus date up to a second. Deduct only 7 hours of DT and then truncate to nearest day:

    SELECT TRUNC (DT - 7/24) DT.

    SUM (PASS_COUNTS)

    From your_table

    TRUNC GROUP (DT - 7/24)

    /

    SY.

  • How to make a button full screen for Flash Catalyst?

    Hey everybody.  I really hope someone can help me with this.  How can I make a button full screen in Flash Professional that would make my Flash Catalyst project go full screen?

    I'm sorry that I don't really know Flash Catalyst as much as I would like. Interface design is left to me, some designers to my agency use catalyst. If it's the Flash forum is as far as I can tell you. I didn't know that catalyst has not supported the Basic scripts (I thought I read that he did).

    In the end, for a very cheap price, you can do something like go to http://www.lynda.com/ and buy a subscription. Very cheap compared to what you get. They offer numerous courses on everything and I am sure that your answer would be in one of the (well broken up by subject) video training videos.

    You are looking for just a catalyst shows a bunch of courses:

    http://www.Lynda.com/search?q=catalyst&x=0&y=0

    Edit:

    For example, I watched the essential training in 2 minutes and CS5.5 chrono, I noticed that when you click on a button, you should have a 'Interactions' Panel that allows you to do things. If they do not have full screen as an interaction that is another thing, but I'm just pointing out, it is very easy to learn to do all sorts of things in the video training. If you don't want to buy a membership he just find a video that you think would have the info in there and I'll watch it and let you know if she tells me how do and how to do it.

  • Get 3 option of windows 7 at startup, how do so only one option?

    Original title: windows

    im getting 3 option of windows 7 start up how to do 1 option?

    as
    Windows 7
    Windows 7
    Windows 7
    and then I'm neutrophilia 1 of them how to remove any other option 2... ??

    Hi John,.

    If you have more than one operating system installed on your computer, you can choose the one that starts when you turn on your computer. More than one operating system installed on a computer is often called a multiboot configuration.

    This can also occur due to any corrupted previous installation of Windows 7.

    If you try to select only the operating system by default to start when you turn on or restart your computer, you can see and try the steps to set the default operating system.

    You can also set the time of the display of the operating system from the list.

    Change the default operating system for startup (multiboot)

    Note: This article also applies to Windows 7.

    If you do not use the other operating system, you can also try the following steps to remove the entry from the boot order and check:

    Note: Make sure that you remove the unwanted entries in the Windows 7 operating systems. If you are not sure, then you need to start using different inputs and check.

    a. click Start , Start search box type msconfig and press ENTER.

    b. click on the Startup tab.

    c. you will see the number of operating systems installed, select the operating system you want to remove.

    d. now click on Remove.

    e. click apply and Ok

    f. restart the computer and check.

    Hope the helps of information. Let us know if you need help with Windows related issues. We will be happy to help you.

  • When I visited, it will make only one clip at a time

    Hi, Ive got a slight problem with rendering and can not find the option to change it. When I press "enter" so that it will only make say a clip which is red, and then it goes into playback mode. How can I set the option so that the entire sequence renders only once?

    Thank you

    Ed

    Ed,

    It is very likely that your WAB (work area bar) does not cover the entire timeline. With emphasis on the timeline, hit \ (backslash key) to develop the scenario. Find the WAB and double click on the little square in the middle to extend that. Now, restore the entire timeline.

    For playback after rendering, if you do not want that, uncheck the box under Edition > Preferences.

    Here's a look at the WAB:

    I think that one is pre, but they are the same.

    Good luck

    Hunt

  • How to make a screen full completed project in Windows Live Movie Maker

    On windows 7, Windows Live Director, after your done with a project how can you make full screen?

    I don't know how to playback in full screen.

    There is a Windows Live Forum for issues related to all Windows Live products - Mail, Photo Gallery, Movie Maker, etc.

    Post your request here for a faster response from specialists Windows Live:

    Windows Live Solution Center
    http://www.windowslivehelp.com/

  • How to make only two columns as editable in five online when the user clicks a line using adf 12.1.3.

    Hello

    I displays a table on the screen. This table is read only during the initial page load. I want to do only two columns as editable on five in a row when the user clicks a line using adf 12.1.3.

    Is it possible in the adf. If possible how to handle this. Please help on this.

    For example, drop table editable Full and then replace rest inputText (components entry in general) with af:outoutText, everything except those two.

    And use the clickToEdit feature...?

  • How to forward only one page at a time?

    I read scanned documents in various who were originally books and booklets. If I have the player mode page two, and I click the page up or page down arrow, player "turn the page". In other words, he's going forward or backward to two pages at a time.

    It's very annoying with these documents. Until very recently, it has only forward one page. In other words, if I was at the bottom of a left pairs page, by clicking on the next page arrow down took me to the top of the straight, odd numbered page. Need me now to the top of the next page. How to get back to the way things were before?

    If used to work like that and now it is not then maybe you have to downgrade to an earlier version. I don't think this is something, which you can specify in the application's preferences.

  • How to make a one to one appointment?

    I have an one to one with the remaining time account, but I can't find a way to make an appointment.

    Hi jaydoc86,

    Thank you for using communities Support from Apple.

    To take a local venue of one-to-one to your Apple Store, please sign in with your Apple ID on the website below and then follow the prompts to create an appointment.

    One-to-one - Apple

    Take care.

  • How to make a video full screen on windows movie maker?

    I made a video using Windows Movie Maker, but every time that I publish it, it comes out with half of the greenery of the screen. Help, please! I have to show the film to my class tomorrow.

    No guarantee, but it might be interesting to try to publish your
    project in DV - AVI format to a folder on your hard drive.

    (The following links should help explain how to record in DV - AVI)

    This image shows where the DV - AVI option.
    http://www.Papajohn.org/IMGs/Vista-PublishToComputerChoices.jpg

    Windows Vista - publish a movie in Windows Movie Maker
    http://Windows.Microsoft.com/en-us/Windows-Vista/publish-a-movie-in-Windows-Movie-Maker

    And... Maybe the following links offers a few ideas:

    Solution problem of Vista Windows Movie Maker green screen!
    http://www.YouTube.com/watch?v=925H7fj-W90

    The Green problem bar setting in Windows Movie Maker
    http://www.bernzilla.com/item.php?id=884

  • Need help how to make "Foglight and Performance analysis CLI - Windows Installation of" because my FMS_HOME is in Oracle. Please notify.

    Please guide me the Foglight command-line installation as I'm not sure how can I continue because my FMS_HOME is in Oracle.

    It seems you are trying to install Foglight agent manager by using the command line installer to ensure the follow-up of your Oracle database.  Foglight Oracle agent can be run either on the Oracle server, or another place as a remote agent locally.  As an agent remote is most common.  In general, this isn't your office, btu a server.  The FMS or another utility server.  You would normally run the installation program from the command line on the computer you want to monitor Oracle of.  Then the agent would run there and collect information of your Oracle instance.  You also mention the analysis of performance in the subject of this thread.  For Performance analysis, which must be a local installation on your Oracle server, but it's a different Installer than indicated above.

    Jeff

  • How to make a symbol full screen

    Hello

    I want my symbol to fit in my browser window. I can't change my symbol W and H % on dashboard interface.

    How can I do?

    Thank you

    Hello

    You can take a look at this link: can a symbol enlarge to full screen?

    Thank you and best regards,

    Roger Simon

  • How to make a one column instead of two text box?

    I inherited this document to someone else, and for some reason any instead of doing the entire page 2 columns, they made the two columns of text individual boxes. How to set the number of columns in a textbox control. I know how to adjust the columns on the entire page, but I don't know how you do in a text box.

    You can set an individual text by choosing object > text frame Options. On the general tab, change the number of columns.

Maybe you are looking for