Inline views information

tell me the difference between inline views and simple view
try to answer with example
thanks

tell me the difference between inline views and
simple view
try to answer with example
Sounds like a coursework question to me.
Why don't you tell us what you think the differences are with examples and we'll tell you where you are misunderstanding.

Similar Messages

  • Tuning query with inline views

    Hi!
    I have a performance problem with the following query. I try to combine v1 and v2 into one inline view but because of the recursive design of the tables workflow and workflow_node it didn't work.
    Does anybody has an idea for tuning this query?
    SELECT distinct v1.u_protocol_id
       FROM ( SELECT workflow_node.workflow_id,u_protocol.u_protocol_id
                   FROM workflow_node,workflow,U_protocol
                   WHERE workflow.workflow_id=workflow_node.workflow_id
                     AND u_protocol.u_protocol_id = workflow_node.parameter_2
                  AND workflow_node.workflow_node_type_id=17
                  AND workflow.workflow_node_type_id=42
             ) v1,
             ( SELECT workflow_node.workflow_id,test_template.test_template_id
               FROM workflow_node,test_template
               WHERE test_template.test_template_id = workflow_node.template
                 AND workflow_node.order_number = 1
                 AND workflow_node.workflow_node_type_id=42
             ) v2,
             ( SELECT aliquot.aliquot_id,test_template.test_template_id
               FROM aliquot,test,test_template
               WHERE aliquot.aliquot_id = test.aliquot_id
                 AND test.test_template_id = test_template.test_template_id
             ) v3
       WHERE v1.workflow_id = v2.workflow_id
         AND v2.test_template_id= v3.test_template_id

    I have found a script (utlxplan.sql) for creating the plan_table so here it is
    SQL> @c:\utlxplan.sql;
    Table created.
    SQL> EXPLAIN PLAN FOR SELECT distinct v1.u_protocol_id
      2     FROM ( SELECT workflow_node.workflow_id,u_protocol.u_protocol_id
      3         FROM lims_sys.workflow_node,lims_sys.workflow,lims_sys.U_protocol
      4         WHERE workflow.workflow_id=workflow_node.workflow_id
      5           AND u_protocol.u_protocol_id = workflow_node.parameter_2
      6        AND workflow_node.workflow_node_type_id=17
      7        AND workflow.workflow_node_type_id=42
      8       ) v1,
      9       ( SELECT workflow_node.workflow_id,test_template.test_template_id
    10         FROM lims_sys.aliquot,lims_sys.test,lims_sys.workflow_node,lims_sys.test_template
    11         WHERE aliquot.aliquot_id = test.aliquot_id
    12           AND test.test_template_id = test_template.test_template_id
    13     AND test_template.test_template_id = workflow_node.template
    14       ) v2
    15     WHERE v1.workflow_id = v2.workflow_id
    16  /
    Explained.
    SQL> SELECT * FROM TABLE(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    | Id  | Operation                           |  Name                           |
    Rows  | Bytes | Cost  |
    |   0 | SELECT STATEMENT                    |                                 |
    PLAN_TABLE_OUTPUT
          |       |       |
    |   1 |  SORT UNIQUE                        |                                 |
          |       |       |
    |   2 |   FILTER                            |                                 |
          |       |       |
    |   3 |    NESTED LOOPS                     |                                 |
          |       |       |
    PLAN_TABLE_OUTPUT
    |   4 |     NESTED LOOPS                    |                                 |
          |       |       |
    |   5 |      NESTED LOOPS                   |                                 |
          |       |       |
    |   6 |       NESTED LOOPS                  |                                 |
          |       |       |
    |   7 |        NESTED LOOPS                 |                                 |
          |       |       |
    PLAN_TABLE_OUTPUT
    |   8 |         NESTED LOOPS                |                                 |
          |       |       |
    |   9 |          TABLE ACCESS BY INDEX ROWID| WORKFLOW                        |
          |       |       |
    |* 10 |           INDEX RANGE SCAN          | FK_WORKFLOW_WORKFLOW_NODE_TYPE  |
          |       |       |
    |  11 |          TABLE ACCESS BY INDEX ROWID| WORKFLOW_NODE                   |
    PLAN_TABLE_OUTPUT
          |       |       |
    |  12 |           AND-EQUAL                 |                                 |
          |       |       |
    |* 13 |            INDEX RANGE SCAN         | FK_WORKFLOW_NODE_WORKFLOW       |
          |       |       |
    |* 14 |            INDEX RANGE SCAN         | FK_WORKFLOW_NODE_NODE_TYPE      |
          |       |       |
    PLAN_TABLE_OUTPUT
    |  15 |         TABLE ACCESS BY INDEX ROWID | U_PROTOCOL                      |
          |       |       |
    |* 16 |          INDEX UNIQUE SCAN          | PK_U_PROTOCOL                   |
          |       |       |
    |  17 |        TABLE ACCESS BY INDEX ROWID  | WORKFLOW_NODE                   |
          |       |       |
    |* 18 |         INDEX RANGE SCAN            | FK_WORKFLOW_NODE_WORKFLOW       |
          |       |       |
    PLAN_TABLE_OUTPUT
    |  19 |       TABLE ACCESS BY INDEX ROWID   | TEST_TEMPLATE                   |
          |       |       |
    |* 20 |        INDEX UNIQUE SCAN            | PK_TEST_TEMPLATE                |
          |       |       |
    |  21 |      TABLE ACCESS BY INDEX ROWID    | TEST                            |
          |       |       |
    |* 22 |       INDEX RANGE SCAN              | FK_TEST_TEST_TEMPLATE           |
    PLAN_TABLE_OUTPUT
          |       |       |
    |  23 |     TABLE ACCESS BY INDEX ROWID     | ALIQUOT                         |
          |       |       |
    |* 24 |      INDEX UNIQUE SCAN              | PK_ALIQUOT                      |
          |       |       |
    |  25 |    INDEX UNIQUE SCAN                | PK_OPERATOR_GROUP               |
          |       |       |
    PLAN_TABLE_OUTPUT
    |  26 |    INDEX UNIQUE SCAN                | PK_OPERATOR_GROUP               |
          |       |       |
    |  27 |    INDEX UNIQUE SCAN                | PK_OPERATOR_GROUP               |
          |       |       |
    |  28 |    INDEX UNIQUE SCAN                | PK_OPERATOR_GROUP               |
          |       |       |
    |  29 |    INDEX UNIQUE SCAN                | PK_OPERATOR_GROUP               |
          |       |       |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
      10 - access("SYS_ALIAS_5"."WORKFLOW_NODE_TYPE_ID"=42)
      13 - access("SYS_ALIAS_5"."WORKFLOW_ID"="WORKFLOW_NODE"."WORKFLOW_ID")
      14 - access("WORKFLOW_NODE"."WORKFLOW_NODE_TYPE_ID"=17)
    PLAN_TABLE_OUTPUT
      16 - access("SYS_ALIAS_4"."U_PROTOCOL_ID"=TO_NUMBER("WORKFLOW_NODE"."PARAMETER
    _2"))
      18 - access("WORKFLOW_NODE"."WORKFLOW_ID"="WORKFLOW_NODE"."WORKFLOW_ID")
      20 - access("SYS_ALIAS_1"."TEST_TEMPLATE_ID"="WORKFLOW_NODE"."TEMPLATE")
      22 - access("SYS_ALIAS_2"."TEST_TEMPLATE_ID"="SYS_ALIAS_1"."TEST_TEMPLATE_ID")
      24 - access("SYS_ALIAS_3"."ALIQUOT_ID"="SYS_ALIAS_2"."ALIQUOT_ID")
    Note: rule based optimization

  • Fine tuning oracle inline view

    Hi All,
    i have a sql query (inline view) which is taking very long time (16 mins Approx) in our environment (Oracle 8.1.7 on Sun).
    Can anyone have any idea to either fine tune the query OR convert it into PL/SQL.
    Query:
    SELECT DISTINCT ML.MFG_LEVEL,          
    SUBSTR(ML.PROCESS_DESC,
    INSTR(ML.PROCESS_DESC, '_', 1, 2) + 1) AS FACILITY,
    SUBSTR(ML.PROCESS_DESC, 1, INSTR(ML.PROCESS_DESC, '_') - 1) AS PACKAGE_NAME,
    SUBSTR(ML.PROCESS_DESC,
    INSTR(ML.PROCESS_DESC, '_') + 1,
    INSTR(ML.PROCESS_DESC, '_', 1, 2) -
    INSTR(ML.PROCESS_DESC, '_') - 1) AS BASIC_TYPE,
    BT.BATCH_TIME_MEAN / BS.BATCH_SIZE AS RUNTIME_BASE,
    ML.TASK_DESC,
    ML.RESOURCE_DESC AS RESOURCE_NAME,
    ML.PROCESS_DESC
    FROM (SELECT DISTINCT RP.VALUE AS MFG_LEVEL,
    TM.TASK_DESC,
    RM.RESOURCE_DESC,
    PC.PROCESS_DESC
    FROM DWH_MCD.TASK_MASTER TM,
    DWH_MCD.TASK_PARAMETER_MASTER TP,
    DWH_MCD.RESOURCE_MASTER RM,
    DWH_MCD.PROCESS_PLAN PP,
    DWH_MCD.PROCESS PC,
    DWH_MCD.RESOURCE_PARAMETER RP,
    DWH_MCD.PARAMETER_TYPE PT
    WHERE PC.PROCESS_ID = PP.PROCESS_ID AND PP.TASK_ID = TM.TASK_ID AND
    TM.TASK_ID = TP.TASK_ID AND TP.RESOURCE_ID = RM.RESOURCE_ID AND
    RP.RESOURCE_ID = RM.RESOURCE_ID AND
    PT.PARAMETER_TYPE_ID = RP.PARAMETER_TYPE_ID AND
    PT.PARAMETER_TYPE_ID = 220037 -- AREA i.e MFG_LEVEL
    AND(TM.TASK_DESC NOT LIKE '%SUBCON%' OR
    PC.PROCESS_DESC NOT LIKE '%VF%')) ML,
    (SELECT DISTINCT TP.VALUE AS BATCH_TIME_MEAN,
    TM.TASK_DESC,
    RM.RESOURCE_DESC,
    PC.PROCESS_DESC
    FROM DWH_MCD.TASK_MASTER TM,
    DWH_MCD.TASK_PARAMETER_MASTER TP,
    DWH_MCD.RESOURCE_MASTER RM,
    DWH_MCD.PROCESS_PLAN PP,
    DWH_MCD.PROCESS PC,
    DWH_MCD.RESOURCE_PARAMETER RP,
    DWH_MCD.PARAMETER_TYPE PT
    WHERE PC.PROCESS_ID = PP.PROCESS_ID AND PP.TASK_ID = TM.TASK_ID AND
    TM.TASK_ID = TP.TASK_ID AND TP.RESOURCE_ID = RM.RESOURCE_ID AND
    RP.RESOURCE_ID = RM.RESOURCE_ID AND
    PT.PARAMETER_TYPE_ID = TP.PARAMETER_TYPE_ID AND
    PT.PARAMETER_TYPE_ID = 220030 -- BATCH TIME MEAN
    AND(TM.TASK_DESC NOT LIKE '%SUBCON%' OR
    PC.PROCESS_DESC NOT LIKE '%VF%')) BT,
    (SELECT DISTINCT TP.VALUE AS BATCH_SIZE,
    TM.TASK_DESC,
    RM.RESOURCE_DESC,
    PC.PROCESS_DESC
    FROM DWH_MCD.TASK_MASTER TM,
    DWH_MCD.TASK_PARAMETER_MASTER TP,
    DWH_MCD.RESOURCE_MASTER RM,
    DWH_MCD.PROCESS_PLAN PP,
    DWH_MCD.PROCESS PC,
    DWH_MCD.RESOURCE_PARAMETER RP,
    DWH_MCD.PARAMETER_TYPE PT
    WHERE PC.PROCESS_ID = PP.PROCESS_ID AND PP.TASK_ID = TM.TASK_ID AND
    TM.TASK_ID = TP.TASK_ID AND TP.RESOURCE_ID = RM.RESOURCE_ID AND
    RP.RESOURCE_ID = RM.RESOURCE_ID AND
    PT.PARAMETER_TYPE_ID = TP.PARAMETER_TYPE_ID AND
    PT.PARAMETER_TYPE_ID = 220008 -- BATCH SIZE
    AND(TM.TASK_DESC NOT LIKE '%SUBCON%' OR
    PC.PROCESS_DESC NOT LIKE '%VF%')) BS
    WHERE ML.TASK_DESC = BT.TASK_DESC AND ML.RESOURCE_DESC = BT.RESOURCE_DESC AND
    ML.PROCESS_DESC = BT.PROCESS_DESC AND ML.TASK_DESC = BS.TASK_DESC AND
    ML.RESOURCE_DESC = BS.RESOURCE_DESC AND
    ML.PROCESS_DESC = BS.PROCESS_DESC;
    Please feel free to ask me for more information if needed.
    Thank You.
    Best Regards,
    Jawahar.

    Jawahar,
    Before you run this sql statement analyse those tables which you use in that query using dbms_utility.analyse_schema() then create one Mview for that query. Before you do all this use "Explain Plan for" this query and observe the statistics. See you need to create a table for Explain Plan. You can find that script in ORACLE_HOME/rdbms/admin/utlxplan.sql
    Kamalesh JK
    jkkstar inc

  • Inline View

    I am working in very important sector in Canada and using Oracle widely. There is a group of experienced managers and developer who discourage to use inline views. They have some reasons in addition to (may be misleading) information pass on by Oracle. According to them Inline views are �devils work�. It gives wrong results and poor in performance. They also refer an oracle bug, which I believe is a misleading info by Oracle (probably same guy).
    http://metalink.oracle.com/metalink/plsql/showdoc?db=Bug&id=1227266
    I have posted a question against that bug to Oracle (metalink.oracle.com) PL/SQL FORUM. I think Note:118978.1 is right and if we incorporate aliases we will never face problem. I have widely used inline views and never faced wrong results. In my opinion Inline views made life simple and easy. Its performance is excellent and save a lot of time rather to write multiple SQLs, which make the maintenance job difficult. Considering you an authority on Oracle. I want to seek expert opinion about Inline view. Please keep in mind that here we use lot of SQLs just to avoid inline views and some time convert some SQLs into real Views just to get rid of inline view. Your note could help me to convince my manager to allows us to use inline views.
    Regards,
    Amer

    I need comments from other experts using metlinks but some how not getting any response.Because it's pointless. If your managers and colleagues don't trust you why the heck should they listen to a bunch of nobodies like us> You've got Tom Kyte on your side, he's the Oracle VP of database technology, he's the biggest howitzer in the field. If they go up against him they're going to be flattened.
    Unfortunately there is no cure for human stupidity (I speak as a long term sufferer), and in my experience people with entrenched positions are rarely willing to admit that they were wrong. Particularly when any outsider can see that they are obviously wrong.
    As I see it, you have two choices:
    (1) Knuckle down, don't use inline views.
    (2) Be assertive, use inline views. When challenged demand that they both prove that your implementation is buggy and provide an adequate alternative (as performant, as easy to understand, more reliable).
    Be aware that if you take line (2) you must ensure your code is bulletproof: test it rigourously. By forcing them to look at the code, you can undermine their arguments with fact, an ounce of which is worth a ton of opinion.
    Cheers, APC

  • Is it possible to view information such as play count on Artist view in itunes 11?

    is it possible to view information such as play count on Artist view in itunes 11?

    There is no column view for the artist tab in iTunes 11. The songs are chunked up by album, no option for list view, let alone column chooser. Also, everything under view > column browser is grayed out.

  • Passing a value to Inline View  WHERE clause through JDev...

    Hi ,
    I need to pass a value to inline view which is mentioned in below VIEW query.
    That view is created inside a view using jDev. Note that there are two WHERE clauses one in the Main query and the other in the Inline view.
    How to set the value for the innerView.
    //copied the code from Java
    view.volAlertsHistroyView.setWhereClauseParam(1, new Integer(clientId));
    Gives an error Missing IN or OUT parameter at index:: 1
    SELECT Alerts.SEND_TIME,
         Alerts.STATUS,
         Alerts.TEXT ,
         Groups.NAME,
              VolRoles.ROLE_NAME,
                   VolRoles.ID as vid,
                   Groups.ID as gid
         FROM ALERTS Alerts, ALERTS_GROUPS AlertsGroups, GROUPS Groups, VOL_ROLES VolRoles,
    --Inline view starts
    (SELECT GRP_ID, VRL_ID FROM vol_groups WHERE cli_id = :1) user_group_role
    --Inline view ends
    --Actual WHERE clause starts
         WHERE ((Alerts.ID = AlertsGroups.ALT_ID)AND (AlertsGroups.GRP_ID = Groups.ID))AND (AlertsGroups.VRL_ID = VolRoles.ID)
         AND AlertsGroups.VRL_ID = user_group_role.VRL_ID AND AlertsGroups.GRP_ID = user_group_role.GRP_ID
    Please get back to me .
    Regards
    Mohan
    [email protected]

    What happens when you change your Java code to:
    view.volAlertsHistroyView.setWhereClauseParam(0, new Integer(clientId));
    The ":1" does not directly relate to the where clause param index you use in Java. In your query you could also use a ":2" for example. In BC4J you still use "0" for the first param.
    Sascha

  • Does an inline view execute before the rest of the select?

    Hi,
    The O'Reilly book Mastering Oracle Sql defines an inline view simply as a
    subquery in a select FROM clause. This conforms to the definitions in
    the Oracle 9i and 10g docs.
    But unlike the Oracle docs, the O'Reilly book says the inline view is,
    like a WITH clause, executed before the rest of the query. I can't see
    how this can be done unless the inline view makes no reference to
    other tables joined in the FROM clause.
    Is there a species of inline view in 9i/10g that IS restricted as above -
    no refs to other tables in the FROM clause - and what is it called?
    Thanks for any help.
    Ken Quirici

    As explained above, Oracle can choose to merge the query if feasible to do so. Look at the two queries and their plans below. The plan in second query changes to creating a temporary VIEW since in that case, Oracle is unable to perform the merge:
    SQL> select *
      2          from scott.emp e,
      3                  (select * from scott.dept d where d.deptno = 10) dd
      4  where
      5          e.deptno = dd.deptno
      6  /
         EMPNO ENAME      JOB              MGR HIREDATE           SAL       COMM     DEPTNO     DEPTNO DNAME          LOC
          7782 CLARK      MANAGER         7839 09-JUN-1981       2450                    10         10 ACCOUNTING     NEW YORK
          7839 KING       PRESIDENT            17-NOV-1981       5000                    10         10 ACCOUNTING     NEW YORK
          7934 MILLER     CLERK           7782 23-JAN-1982       1300                    10         10 ACCOUNTING     NEW YORK
    3 rows selected.
    Execution Plan
    Plan hash value: 3570059291
    | Id  | Operation                    | Name           | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT             |                |     3 |   171 |     2   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS                |                |     3 |   171 |     2   (0)| 00:00:01 |
    |   2 |   TABLE ACCESS BY INDEX ROWID| DEPT           |     1 |    20 |     1   (0)| 00:00:01 |
    |*  3 |    INDEX UNIQUE SCAN         | PK_DEPT        |     1 |       |     0   (0)| 00:00:01 |
    |   4 |   TABLE ACCESS BY INDEX ROWID| EMP            |     3 |   111 |     1   (0)| 00:00:01 |
    |*  5 |    INDEX RANGE SCAN          | IDX_EMP_DEPTNO |     3 |       |     0   (0)| 00:00:01 |
    SQL> select *
      2          from scott.emp e,
      3                  (select * from scott.dept d where d.deptno = 10 and rownum > 0) dd
      4  where
      5          e.deptno = dd.deptno
      6  /
         EMPNO ENAME      JOB              MGR HIREDATE           SAL       COMM     DEPTNO     DEPTNO DNAME          LOC
          7782 CLARK      MANAGER         7839 09-JUN-1981       2450                    10         10 ACCOUNTING     NEW YORK
          7839 KING       PRESIDENT            17-NOV-1981       5000                    10         10 ACCOUNTING     NEW YORK
          7934 MILLER     CLERK           7782 23-JAN-1982       1300                    10         10 ACCOUNTING     NEW YORK
    3 rows selected.
    Execution Plan
    Plan hash value: 1670713873
    | Id  | Operation                       | Name           | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                |                |     5 |   280 |     2   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS                   |                |     5 |   280 |     2   (0)| 00:00:01 |
    |   2 |   VIEW                          |                |     1 |    19 |     1   (0)| 00:00:01 |
    |   3 |    COUNT                        |                |       |       |            |          |
    |*  4 |     FILTER                      |                |       |       |            |          |
    |   5 |      TABLE ACCESS BY INDEX ROWID| DEPT           |     1 |    20 |     1   (0)| 00:00:01 |
    |*  6 |       INDEX UNIQUE SCAN         | PK_DEPT        |     1 |       |     0   (0)| 00:00:01 |
    |   7 |   TABLE ACCESS BY INDEX ROWID   | EMP            |     5 |   185 |     1   (0)| 00:00:01 |
    |*  8 |    INDEX RANGE SCAN             | IDX_EMP_DEPTNO |     5 |       |     0   (0)| 00:00:01 |
    SQL> disconnect
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL>
    can it, in it's WHERE clause, reference other tables in the FROM clause?No. it cannot. but as said above, tha may not stop Oracle from merging the queries.
    SQL> select *
      2          from scott.emp e,
      3                  (select * from scott.dept d where d.deptno = 10 and e.sal > 1000) dd
      4  where
      5          e.deptno = dd.deptno
      6  /
                    (select * from scott.dept d where d.deptno = 10 and e.sal > 1000) dd
    ERROR at line 3:
    ORA-00904: "E"."SAL": invalid identifier
    SQL>

  • Disable inline viewing of attachments in Mavericks mail

    Dear all
    In previous version of the OS, there was an easy terminal fix to disable inline viewing of attachments in mail. Instead of bulky and cumbersome images and PDFs, I used to get nice, neat icons.
    This terminal fix doesn't seem to work in Mavericks.
    Online sources tell me to buy a separate app called Attachment Tamer to fix this.
    Just wanted to find out whether there is a way to do this without additional software.
    Thanks in advance
    Best regards
    Zam

    Sorry, that page is a description of the basic functionality that is supposed to work in Mavericks, but is entirely failing to work for me. I tried calling Apple Support on the phone, and went through many attempted fixes with the experts, but they eventually threw up their hands in despair.

  • Issue with Inline View Criteria

    Hi,
    I have a VO created on two tables that are joined by a 1:1 association(say Opportunity and Revenue). The query is specified in Expert mode because I need some aggregations performed using analytic functions. Data security predicates are applied on top of this query using a dummy View Criteria. My requirement now is that I need to filter these results using another VC. The issue is that both the tables have attributes with the same name(say Cust ID) and I need to filter based on this using an inline View Criteria. I have done the same declaratively. However, I get an error on hitting the page saying the columns have been ambiguously defined.
    On digging through the log, I discovered the test Query fails to prefix the alias before the attribute. So what I get is something similar to this
    select (o.id, r.amt, sum(), count(), avg(), o.custId) from opty o, revn r where (o.id in DATA SECURITY PREDICATE) and (custId = :bindCustId)
    Is there a way to ensure that the custId can be changed to o.custId???
    Note - The View Criteria was created on an attribute from opty table that was exposed i.e in this case, o.custId. Although the query builder shows it correctly while creating the VC declaratively, the issue persists as seen from the logs.
    Thanks,
    Manoj

    Hi experts...
    Any pointers to this issue???
    Please help!
    Regards,
    Debolina

  • [sql performance] inline view , group by , max, join

    Hi. everyone.
    I have a question with regard to "group by" inline view ,
    max value, join, and sql performance.
    I will give you simple table definitions in order for you
    to understand my intention.
    Table A (parent)
    C1
    C2
    C3
    Table B (child)
    C1
    C2
    C3
    C4 number type(sequence number)
    1. c1, c2, c3 are the key columns of tabla A.
    2. c1, c2, c3, c4 are the key columns of table B.
    3. table A is the parent table of Table B.
    4. c4 column of table b is the serial number.
    (c4 increases from 1 by "1" regarding every (c1,c2,c3)
    the following is the simple example of the sql query.
    select .................................
    from table_a,
    (select c1, c2, c3, max(c4)
    from table_b
    group by c1, c2, c3) table_c
    where table_a.c1 = table_c.c1
    and table_a.c2 = table_c.c2
    and table_a.c3 = table_c.c3
    The real query is not simple as above. More tables come
    after "the from clause".
    Table A and table B are big tables, which have more than
    100,000,000 rows.
    The response time of this sql is very very slow
    as everyone can expect.
    Are there any solutions or sql-tips about the late response-time?
    I am considering adding a new column into "Table B" in
    order to identify the row, which has max serial number.
    At this point, I am not sure adding a column is a good
    thing in terms of every aspect.
    I will be waiting for your advice and every response
    will be appreciated even if it is not the solution.
    Have a good day.
    HO.
    Message was edited by:
    user507290

    For such big sources check that
    1) you use full scans, hash joins or at least merge joins
    2) you scan your source data as less as possible. In the best case each necessary table only once (for example not using exists clause to effectively scan all table via index scan).
    3) how much time you are spending on sorts and hash joins (either from v$session_longops directly or some tool that visualises this info). If you are using workarea_size_policy = auto, probably you can switch to manual for this particular select and adjust sort_area_size and hash_area_size big enough to do as less as possible sorts on disk
    4) if you have enough free resources i.e. big box probably you can consider using some parallelism
    5) if your full scans are taking big time check what is your db_file_multiblock_read_count, probably increasing it for this select will give some gain.
    6) run trace and check on what are you waiting for
    7) most probably your problem is IO bound so probably you can do something from OS side to make IO faster
    8) if your query now is optimized as much as you can, disks are running as mad and you are using all RAM then probably it is the most you can get out of your box :)
    9) if nothing helps then you can start thinking about precalculations either using your idea about derived column or some materialized views.
    10) I hope you have a test box and at least point (9) do firstly on it and see whether it helps.
    Gints Plivna
    http://www.gplivna.eu

  • How can I view information about an image, such as the file name and exposure,  on the Ipad?

    how can I view information about an image, such as the file name and exposure,  on the Ipad?

    You can't with the built-in Photos app, but there are apps such as iPhoto which allow you to see the exposure details (aperture, shutter speed, focal length, ISO). PhotoMeta also shows you that info

  • Can You Explain This SQL Query - Inline View Included

    The query is taken from "Oracle Database 10g: SQL Fundamentals II" page 3-7 (chapter 3)
    I do not fully understand the following query:
    SELECT a.last_name, a.salary, a.department_id, b.salavg
    FROM   employees a, (SELECT   department_id,
    AVG(salary) salavg
    FROM     employees
    GROUP BY department_id) b
    WHERE  a.department_id = b.department_id
    AND    a.salary > b.salavg;
    The inline view can return several records. Can you please tell me in step by step how does this work. I understand the concept of join tables and aliases, etc. I just need to know the mechanism of this code.
    Thanks

    user11164565 wrote:
    The query is taken from "Oracle Database 10g: SQL Fundamentals II" page 3-7 (chapter 3)
    I do not fully understand the following query:
    SELECT a.last_name, a.salary, a.department_id, b.salavg
    FROM   employees a, (SELECT   department_id,
    AVG(salary) salavg
    FROM     employees
    GROUP BY department_id) b
    WHERE  a.department_id = b.department_id
    AND    a.salary > b.salavg;
    The inline view can return several records. Can you please tell me in step by step how does this work. I understand the concept of join tables and aliases, etc. I just need to know the mechanism of this code.
    The query is returning the last name, salary , department and average salary of all the departments where salary is greater than the average salary.
    HTH
    Aman....

  • Using inline view with NOT IN clause

    I have a query with a NOT IN clause in the where clause that I would like to convert to an inline view. The select looks something like this:
    select uid, SYSDATE from tab1, tab2
    where tab1.uid = tab2.uid
    and ...
    and tab1.uid not in (select uid from tab3 where....)
    I've used inline queries elsewhere to great effect, but this one has me stumped. If anyone can help, it would be greatly appreciated.

    There can be problem with using not in or not exists depending on the amount of data in the tables and the relationship between them.
    I didn't got if you had problem with the existing SQL-statement, created view or both.
    Check statistics and look at explain plan for the sql-statement and the view.
    The problem can actually be some where clause that you have in the sql-statement but not in the view, but apply later when using the view.
    //Anders

  • Need help with SQL Query with Inline View + Group by

    Hello Gurus,
    I would really appreciate your time and effort regarding this query. I have the following data set.
    Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
    1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*20.00*-------------19
    1234567----------11223--------------7/5/2008-----------Adjustment for bad quality---------44345563------------------A-----------------10.00------------19
    7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
    4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765--------------------I---------------------30.00-------------19
    Please Ignore '----', added it for clarity
    I am trying to write a query to aggregate paid_amount based on Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number and display description with Invoice_type 'I' when there are multiple records with the same Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number. When there are no multiple records I want to display the respective Description.
    The query should return the following data set
    Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
    1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*10.00*------------19
    7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
    4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765-------------------I---------------------30.00--------------19
    The following is my query. I am kind of lost.
    select B.Description, A.sequence_id,A.check_date, A.check_number, A.invoice_number, A.amount, A.vendor_number
    from (
    select sequence_id,check_date, check_number, invoice_number, sum(paid_amount) amount, vendor_number
    from INVOICE
    group by sequence_id,check_date, check_number, invoice_number, vendor_number
    ) A, INVOICE B
    where A.sequence_id = B.sequence_id
    Thanks,
    Nick

    It looks like it is a duplicate thread - correct me if i'm wrong in this case ->
    Need help with SQL Query with Inline View + Group by
    Regards.
    Satyaki De.

  • [SQL] inline view and order by on oracle 8.0.5

    Hi everyone.
    I am trying to sort data inside "inline view"
    on "Oracle8 Release 8.0.5.0.0 - Production".
    However, it did not work. Is this an oracle-bug?
    I got the oracle error , "ORA-00907".
    The sql script is like this:
    select ..............
    from (select ..... from .. where .... order by ...)
    where rownum <11
    However, the "exactly" same sql has no problem
    on "Oracle8i Enterprise Edition Release 8.1.7.0.0".
    Every response will be greatly appreciated.
    Thanks in advance.
    Ho.

    Order by cannot be used in a subquery while for inline view it is supported but in Oracle8i, release 8.1 and up
    Khurram

Maybe you are looking for

  • How to move songs from mini to PC?

    I have an iPod mini with songs that aren't on my PC. In iTunes, when I try to drag songs from the mini to a local playlist, iTunes doesn't allow it. Any suggestions?

  • SPACE ITUNES IS TAKING UP ON COMPUTER HARD DRIVE

    I HAVE DOWNLOADED MY MUSIC FROM ITUNES T0 IPOD (30GB VIDEO). I AM GETTING A COMPUTER SYSTEM MESSAGE THAT I AM RUNNING LOW ON HARD DISC SPACE. IF I CLEAR MY ITUNES LIBRARY TO FREE UP SPACE, WILL IT CLEAR MY IPOD THE NEXT TIME I CONNECT?

  • Code Coloring, ASP/VBScript, & CS5

    My IT area has set up the web  server  to process all .HTM files as if they were .ASP. Subsequently, I  cannot  view my HTM files as they would appear if they were "true" ASP  files in  Dreamweaver CS5. I applied the changes described in TechNote  16

  • Cannot download drivers for Bootcamp

    Hello i want to install Windows 7 on my new Macbook Pro '12 10.8 as i open the boot camp assitant and try to download the drivers for windows the stauts bar stucks at about 33% and nothing happend. On my old Macbook with 10.6 the assistant says that

  • Copy photos back into camera roll in order

    Hi there, hope someone can help! I copied a bunch of photos off from 2011 into iPhoto and deleted them from my phone, however I would like to put them back in but i'd like them to go in the camera roll back at the top so they are the first photos I t